Solved

How to modify multiple field of an access table

Posted on 2013-01-14
5
350 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Post your Code here and I'll see if I can help out...
0
 

Author Closing Comment

by:alam747
Comment Utility
Thanks
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Outlook Free & Paid Tools
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

744 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now