B
brodie_ou
Guest
I have the following code in the Click Event of a button a form:
os.Open "select count(*) from [Tasks] where [SerialNumber] = '" & strTo & "' and " & _
"[Task No] = " & lngTaskNum & " and [TaskName] = '" & strTaskName & "' and [Type] = 'Insp'", CurrentProject.Connection
I am having problems if the variable strTaskName contains a single quote. I changed the query attempting to pass it with double quotes around the field value, but I assume I'll continue to run into problems if the variable contains double quotes.
I also attempted to edit the forms where this data is entered so the users cannot enter data that contains quote or double quotes, but have not successfully figured out the syntax of the validation rule.
Any ideas?
os.Open "select count(*) from [Tasks] where [SerialNumber] = '" & strTo & "' and " & _
"[Task No] = " & lngTaskNum & " and [TaskName] = '" & strTaskName & "' and [Type] = 'Insp'", CurrentProject.Connection
I am having problems if the variable strTaskName contains a single quote. I changed the query attempting to pass it with double quotes around the field value, but I assume I'll continue to run into problems if the variable contains double quotes.
I also attempted to edit the forms where this data is entered so the users cannot enter data that contains quote or double quotes, but have not successfully figured out the syntax of the validation rule.
Any ideas?