Access 2010 Inserting temporary variables into fields in a table

How do I insert  tempvar values into existing fields in a table? I have values from a form assigned to temporary variables through a macro. I would like to insert them to an existing table by way of a macro. Please elaborate the syntax when doing this in an insert query.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

To Append to a table:
Insert Into NameOfTable (NameOfField1, NameOfField2) Values (TempVars!NameOfTempVar1, TempVars!NameOfTempVar2)

Open in new window

To Update a table:
Update NameOfTable Set NameOfField1 = TempVars!NameOfTempVar1, NameOfField2 = TempVars!NameOfTempVar2

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Is this a one time data fix up?  How will you determine the correct value?  How will you determine which row to update?  Are you thinking you need to scroll through the recordset of the form and update one record at a time (not a good idea)?  

This type of bulk update should be done with a query if the value is constant such as populating a field with a default value.  If the value is calculated, you shouldn't be doing this at all.  Calculations should happen in the query when you retrieve the data.

Update YourTable Set SomeField = 0 Where SomeField Is Null;
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.