Link to home
Start Free TrialLog in
Avatar of alam747
alam747

asked on

How to modify multiple field of an access table

Hi Exparts,

I used the following VBA code to modify a table field:
Currentdb.execute "Update tblTarget_sr INNER JOIN tblMerged_test ON tblTarget_sr.[Customer Part]=tblMerged_test.[Part No] SET tblTarget_sr[Target total time]=tblMerged_test.[total time]

But I have more three fields in Update tblTarget_sr that need to modified at the same time while the above condition met.

Please advise me what would be the VBA code to modify other fields.

Thanks
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Just add them to the SET clause like this:

Update tblTarget_sr INNER JOIN tblMerged_test ON tblTarget_sr.[Customer Part]=tblMerged_test.[Part No] SET tblTarget_sr[Target total time]=tblMerged_test.[total time], Field2 = abc, Field3 = XYZ, Field4 = NNN, etc..

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of alam747
alam747

ASKER

Thanks for your prompt response.

I have several field to update therefore its too long, I used _ (a space and underscore but its giving me compile error.
Is there anything need to do like shift key or anything else.

Thanks
Post your Code here and I'll see if I can help out...
Avatar of alam747

ASKER

Thanks