Find Record

D

Don S

I have a combo box on a form to find a record which I set up using the
wizard. However, it will not pull up some of the records. It seems to not
want to find those records where there is an apostrophy in the name such as
Arby's or Papa John's. All other records are displayed as selected.

Any ideas?
 
J

John W. Vinson

I have a combo box on a form to find a record which I set up using the
wizard. However, it will not pull up some of the records. It seems to not
want to find those records where there is an apostrophy in the name such as
Arby's or Papa John's. All other records are displayed as selected.

Any ideas?

Delimit the search string with " instead of '.

For help doing so, please post your code. We can't see it from here...
 
D

Don S

I don't understand. The name in the data field has an apostrophy as in
Arby's or Papa John's. I am searching for the record that matches the
specific name of the company. Thanks
 
J

John W. Vinson

I don't understand. The name in the data field has an apostrophy as in
Arby's or Papa John's. I am searching for the record that matches the
specific name of the company. Thanks

If your search is for

'Arby's'

using the code generated by the wizard - which again, WE CANNOT SEE since you
have chosen not to post it! - the apostrophe will be seen as the end of the
string; you'll be left with a meaningless

s'

which will cause the query to fail.

The code is easy to fix - if you'll be so kind as to open the event in the vba
editor and copy and paste the code to a message here, someone (not me, I'm
leaving town!) should be able to help.
 
L

Linq Adams via AccessMonster.com

If you used the Combobox Wizard to do this you have a line in the combobox's
AfterUpdate event that looks similar to this (with your actual object names
replacing Member and cboComboName)

rs.FindFirst "[Member] = '" & Me![cboComboName] & "'"

Replace it with

rs.FindFirst "[Member] = """ & Me![cboComboName] & """"

and the apostrophes won't be a problem.

This was what John meant by

Delimit the search string with " instead of '.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top