Dlookup and Update Query. Err: MS access cant update all records in the update query.

pedie

Well-known Member
Joined
Apr 28, 2010
Messages
3,875
Hi, Currently 'm trying to update a huge table with emp. information. Whn i use below query it does not work.
Can we use dlookup in this Update Query?

Thanks

HTML:
UPDATE MYTAB SET MYTAB.EMPSNAME = DLookUp([EMPSNAME],"EMPES",[EMPSID]=[EMPSID]);
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Try this and see if it works. I created 2 tables (EMPES and myTab) and created an update query. I tried to match your field names best I could, but double-check for accuracy.

Code:
UPDATE EMPES INNER JOIN myTab ON EMPES.EmpsID = myTab.EmpsID SET myTab.EmpsName = [EMPES].[EmpsName]
WHERE (([myTab].[EmpsID]=[EMPES].[EmpsID]));

Btw, I used the query design in MS Access to come up with this. You can always select the Update tab in Query design to work through this.
 
Upvote 0
Pedie

You could use a DLookup, and you've almost got the syntax right.

I won't post what it should be because you shouldn't use DLookUp for this sort of thing.

Use a query like Montez has posted.
 
Upvote 0
Thanks Motex, thanks Norie:)...that worked fine. I tried a lot of time and couldnt make it work...
Now with that it works perfect!

Thanks again.
 
Upvote 0

Forum statistics

Threads
1,224,594
Messages
6,179,795
Members
452,943
Latest member
Newbie4296

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top