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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please help - Combo Lookup frm problem 1

Status
Not open for further replies.

kchernak

Technical User
May 28, 2002
32
0
0
US

I have a form that has a combo box to allow users to lookup a record based on a name field. It works fine except if the name field value as an apostrophy - then I generates a syntax error - missing operator. so it finds "Joes Bakeshop" but not "Joe's Bakeshop". The db is access97, and it hangs on the this code:

Me.RecordsetClone.FindFirst "[ApplicantName] = '" & Me![Combo113].Value & "'"

Any ideas?
Thanks!
 
Happy New Year kchernak . . . . .

Try this:

Me.RecordsetClone.FindFirst "[ApplicantName] = " & Chr(34) & Me![Combo113].Value & Chr(34)

Chr(34) is the double quote character.

TheAceMan [wiggle]

 
AceMan - Thanks! Works like a charm. and Thanks for such a speedy response!
 
OK kchernak . . . . .

I did'nt have time to explain on my previous post.

Your problem is well known in Access. Basically a string identified as a value in an equation requires single or double quotes to make it so.For instance, single quotes results in:

Name = 'Joes'

However if the string has an apostrophe, it becomes:

Name = 'Joe's'

The extra apostrophe causes a parse error. Double quotes results in:

Name = "Joe's"

You have just discovered how double quotes allows you to have an apostrohpe in strings. Your strings are allowed the greatest latitude in this way.

Search Access hep for Quotation Marks In Strings. Its good reading & good to know . . . . .

TheAceMan [wiggle]

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top