I have a form that writes data to a table, but I also want it to write some data to a second table that is not the data source for the form. Is there a way to do that?
On the form, the user picks a day, and all the time slots are shown. Some are "available" and others are not. The user picks which time slot they want. One table (the data source) contains all the days and time slots, and records which ones were picked. In the other table, I want to write which user picked what time slot (then I have e-mails automatically sent, etc).
To update an existing record:
Dim Who as string
dim SQLStr as string
dim insrt as string
SQLStr = "UPDATE [Table] SET [Field1] = """ & Forms![MyForm].txtBox.Value & """" & " WHERE [Field2] = """ & Who & """"
To insert a new record:
insrt = "INSERT INTO [Table]([Field1],[Field2]) VALUES (""" & _
Who & """, " & True & ");"
Hope that helps.
You would need to put this code in an event. Which if event depends on when you want the data to be entered into the table. Look in the Access help files for events to determine which one you want to use.