Criteria in a Lookup field

G

Guest

I want to narrow my search in a query for a group of something in a field.
The field in question is a field I made as a lookup field.

The fields are VolunteerID, LastName, FirstName, and CompanyName.

AWhere the companyname is a lookup field that I had in a table called
Sponsors.
They are linked in a relatioship.

When I try to write my criteria as: =[tables]![Sponsors]![CompanyName]

I get a window asking me ENTER PARAMETER VALUE...
I write the the name of the company I want the information from...

I don get it..

I don't know what to do..Can someone help me..please..

Vero
 
J

Jeff Boyce

If your table has a lookup field, you need to be aware that what it shows in
the field (?your CompanyName) and what it stores in the field (the
CompanyNameID) are NOT the same.

So if, in a query, you are entering a CompanyName, it's not very likely that
Access will ever find it that way.

Check the tablesdbdesign newsgroup and mvps.org/access/ for discussions of
why you don't want to use lookup fields -- your situation is one of them!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
J

John Vinson

I want to narrow my search in a query for a group of something in a field.
The field in question is a field I made as a lookup field.

The fields are VolunteerID, LastName, FirstName, and CompanyName.

AWhere the companyname is a lookup field that I had in a table called
Sponsors.
They are linked in a relatioship.

When I try to write my criteria as: =[tables]![Sponsors]![CompanyName]

I get a window asking me ENTER PARAMETER VALUE...
I write the the name of the company I want the information from...

I don get it..

I don't know what to do..Can someone help me..please..

Vero

The reason it's not finding the company is that the table does not
contain any company names.

It *APPEARS* to contain them, but they are not there: what's stored in
the table, concealed behind the combo box, is a numeric company ID.
You would need to search for 318 to find the company which has 318 as
its CompanyNameID, because THAT's what's in your table.

What you need to do is create a query joining your table to the
Companies (lookup) table, joining by the CompanyID, and put your
criterion on the actual company name from the Company table.

See http://www.mvps.org/access/lookupfields.htm for other examples of
why the Lookup Wizard is frowned upon by many serious Access
developers. This is one of its flaws but it has many more.

John W. Vinson[MVP]
 

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

Similar Threads

Importing Contacts From MS Outlook 1
Table Concatenate Fields Access 2007 1
Access Dcount (multiple criteria) 3
Lookup field in table 4
Displaying two fields in combo box 8
Updating subforms 1
blank fields issue 2
Lookup Table 6

Top