Solved

How to modify multiple field of an access table

Posted on 2013-01-14
5
353 Views
Last Modified: 2013-01-17
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
0
Comment
Question by:alam747
  • 3
  • 2
5 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 38776803
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

0
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 38776807
In VBA:

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], tblTarget_sr.[Field2]  = abc, tblTarget_sr.[Field3] = XYZ, tblTarget_sr.[Field4] = NNN, etc.."

Open in new window

0
 

Author Comment

by:alam747
ID: 38785492
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
0
 
LVL 61

Expert Comment

by:mbizup
ID: 38785533
Post your Code here and I'll see if I can help out...
0
 

Author Closing Comment

by:alam747
ID: 38790760
Thanks
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question