Hi,
I have a form that displays fields from a table (tblRoomHeader), using a Select Query as its record source. If field 'CurrentUse' is changed to a particular value, I need to insert a record onto another table, tblGuestRoom (only need to populate one field).
I have not programmed an Insert before on a form.
Can someone please advise the best place to place the insert logic?
And, is it best to have the SQL right in my module, or set up a Query to do this?
I have set up logic to look something like this.
Just not sure where to put it or what to do with it!
Thanks in advance for any help,
Lori
I have a form that displays fields from a table (tblRoomHeader), using a Select Query as its record source. If field 'CurrentUse' is changed to a particular value, I need to insert a record onto another table, tblGuestRoom (only need to populate one field).
I have not programmed an Insert before on a form.
Can someone please advise the best place to place the insert logic?
And, is it best to have the SQL right in my module, or set up a Query to do this?
I have set up logic to look something like this.
Code:
dim strInsertSQL as string
strInsertSQL = "INSERT INTO tblGuestRoom ( RoomNumber ) " _
& " SELECT tblRoomHeader.RoomNumber FROM tblRoomHeader " _
& " WHERE (((tblRoomHeader.RoomNumber) = '" & RoomNumber & "'));"
Just not sure where to put it or what to do with it!
Thanks in advance for any help,
Lori