Solved

How to modify multiple field of an access table

Posted on 2013-01-14
5
356 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

623 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