Function FixSingleQuotes(String)
FixSingleQuotes = Replace(String, "'", "''")
End Function
strExample = "It's a boy checkbox $8.00"
strExample = FixSingleQuote(strExample)
strSQL = "INSERT INTO [tblName] (strExample) VALUES ('" & strExample
& "');"
--- In [EMAIL PROTECTED], "sean12302000"
<[EMAIL PROTECTED]> wrote:
> Hi There,
>
> I tried this and the program still crashed when I tried the bulk
> insert.
>
> Any other ideas?
>
> Sean - Thanks in advance for your answer
>
> !--- sample
>
> Happy Anniversary $ 8.00 checkbox
> It's a boy $ 8.00 checkbox
> It's a girl $ 8.00 checkbox
>
>
>
> --- In [EMAIL PROTECTED], "John Shepard"
> <[EMAIL PROTECTED]> wrote:
> > Function FixSingleQuotes(String)
> > String = Replace(String, "'", "''")
> > FixSingleQuotes = String
> > End Function
> > --- In [EMAIL PROTECTED], "sean12302000"
> > <[EMAIL PROTECTED]> wrote:
> > > HI There,
> > >
> > > I have an access db to which I am trying to insert multiple
> > strings.
> > > The page has a list of checkboxes and every row has a hidden
> field
> > > with the productid on it, when I have one word values to insert
> > they
> > > are handled without a problem, but when I have multiword (I have
> a
> > > dream) or with single quotes (It's a boy) the program falls over.
> > >
> > > Can someone tell me how I can get around this issue, as I have
> > tried
> > > the string replace method as well as many other things.
> > >
> > > Thanks in advance for your answer
> > >
> > > !-- code
> > >
> > > <input type="hidden" name="chkOptionsID" value='41'>
> > > <tr><td width="70%">Its a boy</td><td>$ 8.00</td><td><input
> > > type="checkbox" name="chkOptions" value='It's a boy'><td></tr>
> > > <input type="hidden" name="chkOptionsID" value='42'>
> > > <tr><td width="70%">Its a girl</td><td>$ 8.00</td><td><input
> > > type="checkbox" name="chkOptions" value='It's a girl'><td></tr>
> > >
> > > for i = 1 to Request("chkOptions").count
> > > strOption = Request.form("chkOptions")
> > >
> > > chkOptionsID = Request("chkOptionsID")(i)
> > > db_conn.Execute "INSERT INTO product_options
> > > (ProductID,OptionValue,IsColour,OptionIDValue) Values(" &
> ProductID
> > > & ",'" & strOption & "','" & IsColour & "'," & chkOptionsID & ")"
> > >
> > > next
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/