General discussion

Locked

DLookup command in Access

By dakota99 ·
I am trying to use a DLookUp command in the control source of an Access 2000 formfield. In my database:

Group=FormField trying to get from the Dlookup
Emp_Names=table that is made up of the fields "Name" and "Group"
Name=field in the Emp_Names table
QCDataEntryForm=The name of the form
Processor=FormField associated with the Tablefield "Name"

My Dlookup command entered in the control source for the "Group" field of the form:

=DLookUp("[Group]","Emp_Names","[Name]=" & [Forms]![QCDataEntryForm]![Processor])

So when the user enters a "processor" on the QCDataEntryForm, I would like the "Group" to automatically fill in with the associated value from the Emp_Names table. The value that is displayed when I run the form is [#error]. I am not sure what to change to get the correct data. Please help.

This conversation is currently closed to new comments.

7 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

DLookup command in Access

by john_wills In reply to DLookup command in Access

Try writing your criterion as "[Name]=" & me.processor

Collapse -

DLookup command in Access

by dakota99 In reply to DLookup command in Access

Thanks for your help. I changed the criteria to:
=DLookUp("[Group]","Emp_Names","[Name]=" & Me.Processor)

The message that is now displayed in the dlookup field id "#Name?"

Collapse -

DLookup command in Access

by john_wills In reply to DLookup command in Access

=DLookUp("[PHYS_ADDR1]","dbo_provsite","[PROV_ID] = " & [Prov_ID])
The above works in one of my reports. Perhaps the "me" in what I told you is inappropriate, but I don't know why. Prov_ID appears in the table for the report as shown by clicking onthe table icon next to the hammer-and-spanner. Does your Processor appear there?

Collapse -

DLookup command in Access

by dakota99 In reply to DLookup command in Access

Poster rated this answer

Collapse -

DLookup command in Access

by Bob Sellman In reply to DLookup command in Access

It looks like you forgot to surround the string value (for Name) with single quotes. So the last part of the DLookUp function would look like this (including the closing parenthesis):

","[Name]='" & [Forms]![QCDataEntryForm]![Processor] & "'")

Collapse -

DLookup command in Access

by dakota99 In reply to DLookup command in Access

I made the changes you suggested...It worked, it worked, it worked!!!!!!! I have been working on this off and on for a number of weeks now. I just couldn't get the syntax quite right.
Thanks for all your help!!!!!!!!!!!!!

Collapse -

DLookup command in Access

by dakota99 In reply to DLookup command in Access

This question was closed by the author

Back to Software Forum
7 total posts (Page 1 of 1)  

Related Forums