If your text boxes are bound to Table2 then the table will be updated automatically.
What do I mean by bound?
The best thing is for you to look at some of the properties in the Property Window in Design View of the form. First select the form and under the Data tab in the Property Window see whether there is an entry against Record Source. If there is, what is it? It could be a table name, a query name or an SQL statement. If Table 2 is involved in any way then you're halfway there.
Now select each text box in turn and, still under the Data tab, see if there is an entry against Control Source. Any entry is usually the name of a table column. Hopefully your control sources are the names of corresponding columns in Table 2.
What if either or both of these bindings are missing? Well you have two options:- Put the appropriate values in the Record Source and Control Source properties such that the form and the text box controls become bound to Table 2. Access will now handle the updates for you.
- Select a suitable point in the user dialog - usually an event - and push the new values into Table 2 via code, either Macro (if feasible) or VBA.
Don't ask me for a Macro solution; the last time I coded a Macro was more than twenty years ago.
The VBA code will look something like the following.
Code:
Dim rstTable2 as DAO.Recordset
Set rstTable2 = CurrentDb.OpenRecordset("Table 2", dbOpenTable)
With rstTable2
.AddNew
!TableField1 = Me.txtField1
!TableField2 = Me.txtField2
...
.Update
End With
rstTable2.Close
set rstTable2 = nothing
You have to substitute your own names for Table 2, TableField1, txtField1, etc.