DLookup in Query Criteria

  • Thread starter Thread starter steve
  • Start date Start date
S

steve

Here is the SQL from the Query Builder in Access. It seems to run OK, it
just does not update the Location field in my Import_From_RPM table.

UPDATE Import_From_RPM
SET Import_From_RPM.Location = DLookUp("[LOCID]","[Locations
Table]","[Location Description]=Tables![Import_From_RPM]![Location Code]");

The Import_From_RPM.Location is a number field, the LOCID is an autonumber
field, Location Description is Text and Location Code is text.

The Locations Table consists of 2 fields, LOCID and Location Description.

I would appreciate someone taking a look at this and pointing me in the
right direction.

TIA

Steve
 
Thanks for the help.

Klatuu said:
The Tablles! reference does not work at all. There is no such reference.
See if this helps.

UPDATE Import_From_RPM
SET Import_From_RPM.Location = DLookUp("[LOCID]","[Locations
Table]","[Location Description] = '" & [Import_From_RPM]![Location Code] &
"'");

steve said:
Here is the SQL from the Query Builder in Access. It seems to run OK, it
just does not update the Location field in my Import_From_RPM table.

UPDATE Import_From_RPM
SET Import_From_RPM.Location = DLookUp("[LOCID]","[Locations
Table]","[Location Description]=Tables![Import_From_RPM]![Location
Code]");

The Import_From_RPM.Location is a number field, the LOCID is an
autonumber
field, Location Description is Text and Location Code is text.

The Locations Table consists of 2 fields, LOCID and Location Description.

I would appreciate someone taking a look at this and pointing me in the
right direction.

TIA

Steve
 

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

Back
Top