|
-
Mar 6th, 2002, 09:07 PM
#1
Thread Starter
New Member
quotation mark (') in recordset filter
Help! posted this at the Database section but can't wait...
I am using an ADO recordset. My program has a text box, the user input of which is used to filter the recordset.
for example,
==
txtName.Text = "Jones" 'this is the input in the textbox
recName.Filter = "LAST_NAME='" & txtName.Text & "' "
==
when the user inputs a single qoutation mark in the text box,
==
txtName.Text = " ' " 'this is the input in the textbox
recName.Filter = "LAST_NAME='" & txtName.Text & "' "
==
an error occurs.
I've tried replacing the textbox input, i.e.,
==
Dim strName As String
strName = Replace(txtName.Text , "', "''") 'replace the single qoute with 2 single qoutes
recName.Filter = "LAST_NAME = '" & strName & "' "
==
which works perfectly when the user input only has one single qoutation mark. however, when the user input 2 single qoutation marks, an error still occurs.
anyone know how to deal with this?
thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|