Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

data affecting vb syntax

Status
Not open for further replies.

chamo

Programmer
Jan 28, 2005
3
US
This code works just perfect if I use something else than Lion's Club for the search, or something else without an apostrophe. I get the error Runtime error '3077'; Syntax error (mission operator) in expression. How can I do that whatever text I'm looking for doesnt affect the syntaxis. Thanks

Dim db As Database
Dim rst As DAO.Recordset
Set db = CurrentDb
Set rst = db.OpenRecordset("agency", dbOpenDynaset)

xagency = Me.agency.Text
rst.FindFirst "[agency] =' "Lion's Club" ' "
If rst.NoMatch And xagency <> "" Then
MsgBox "No Records Matching " & InputText, vbOKOnly, "No Matching"
xno = 1
Else
xno = 0
End If

 
Try changing apostrophe from the word. It is the culprit. There was some work around.
Yeah it is here
thread705-860086
Regards

Zameer Abdulla
JVBP MDS
Jack of Visual Basic Programming, Master in Dining & Sleeping
Visit Me
 
Personally I use this technique (works for DAO and ADO):
rst.FindFirst "[agency]=' & Replace(strSearch, [tt]"'", "''"[/tt]) & "'"


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top