Originally posted by Conchur
You need to escape out the single quote character. In Access you can do this by using the single quote twice.
Try something like this:
Public Function Quote(varValue)
If IsNull(varValue) Or IsEmpty(varValue) Then
Quote = "Null"
Quote = "'" & Replace(varValue, "'", "''") & "'"
This function puts single quotes around the string, and doubles any inside it, so your SQL would now be:
strSQL = "SELECT * FROM Applicant WHERE (((Applicant.FirstName)=" & Quote(Me.tb_firstname) & ") AND ((Applicant.LastName)=" & Quote(Me.tb_lastname) & "));"
That's a good Idea but it still nukes on it ... I check for Null prior to using the so all I have to do is call the Quote..... maybe I should just create a recordSet and use FindFirst... that doesn't seem to blowup..... would seem that it's just a simple thing....
Originally posted by playernovis
CHR function returns any character represented by ACSII code
34 is doublequote
I guess me confussion steemed from using PowerBuilder's function.... Char(long) converted a Number to a String..... and in the VBA defination of Chr it's
Function Chr(CharCode As Long)...... apparently I didn't look at the definition closely enough... CharCode hence the 34 as Double Quote