Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add Record to fields into another table from a form 1

Status
Not open for further replies.

OzzieOwl

Technical User
Dec 13, 2001
45
0
0
GB
Help

I need to populate a table from an action on a form, I am running VBA on exit of a field on a form, and need to update another table (not the one the form is linked to).
I have the table set up, and all the values I need are stored as variables, I just need to know how to assing those to a new record in the tabel.

I am new to access VBA, so any help would be appreciated.

Thanks

Ozzie



 
Hallo,

You need to use RunSQL to run an Action Query. See help on RunSQL for details.
The SQL you will need will look something like:
"INSERT INTO tblTable (strStringField, intNumericField) VALUES (""" & Me!txtStringField & """, " & Me!txtNumericField & ");"
Note the different number of "'s in the VALUES clause for Strings and numbers.
See help on INSERT INTO for more details.

- Frink
 
Brilliant.

Thanks Frink after a bit of tweaking to suit my application that works perfectly.

Star on its way to you

Many Thanks

Ozzie

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top