Hello Paul,
I've had similar stuff in the past... I'll try to give you a hand, but keep in mind I'm a noobie.
I use forms to enter data, and fire events that update tables... which is where the "After Update" event is that Trevor was talking about... the tables just store the data, the form is where your event will fire from. So, if you create a form based on one of your tables, and you want it to update/insert data in two tables you can do that one of two ways:
-Use SQL to insert/update both tables, which takes two update queries
-Or Use and SQL query to insert/update into one table and bind the form and fields to the data in the other table
There is a distinction between "Insert" and "Update" queries though. Your "Insert" query will produce a brand new record in your table, and the "Update" query will modify a current record in a table. So, once you create the form, right click and hit properties (unless the property sheet is already open on the right). Then under the "Events" tab on the property sheet you'll see the "after update" option. Click in that box, then click the "..." on the right side. Then it will ask you what you want to do (Macro Builder, Expression Builder, Code Builder), select code builder to take you to your VBA.
There will now already be a sub set up that looks like:
Private Sub Form_AfterUpdate()
End Sub
You just need to put the code in the middle there so it looks like:
Private Sub Form_AfterUpdate()
Dim db As DAO.Database
Set db = CurrentDb
db.execute "INSERT INTO Table1Name (Column1, Column2) " & _
"VALUES ( '" & TxtBoxOne & "', '" & TxtBoxTwo & "' )"
db.execute "INSERT INTO Table2Name (Column1, Column2) " & _
"VALUES ( '" & TxtBoxOne & "', '" & TxtBoxTwo & "' )"
Set db = Nothing
End Sub
You can copy/paste that code and it should work after you change "Table1Name" to your first table's name, Column1&2 to your Column names and TxtBoxOne&Two to your Text Boxes names... change appropriately for Combo box, list box etc... as long as the name matches it works. By the way, the " & _ and then quotes on the next line is like a carriage return, so you can take that out if you want it on one line.
An update query would be slightly more difficult, because you would have to find and filter the data you wanted to update but it would be written in the following format:
UPDATE TableName SET Column1Name = [Value1], Column2Name = [Value2] WHERE [SomeColumn] = [SomeValue]
That should all be on one line (I didn't put in the " & _ ). If you wanted it to populate those values from a textbox, combo, etc you'd replace "[Value]" with '" & TxtBoxOne & "' like the above.
Sorry, if I missed my point of aim and either wrote over your head or way under your level of expertise...
Pick