I have a database that consist of two primary tables:
I have created a button that deletes a patron from the tables [tblPatrons] INNERJOIN [tblRooms] by opening a form requesting the user input the room to update. The second part of this action updates the table [tblRooms].[Availability] to Available where [tblRooms].[Room] is the typed room. When inserted and ok'd the following code is ran and the delete query works correctly. The update does not. It gives no error code but just shows 0 rows updated. When ran mannualy as a query the Update Query works correctly.
Table meta data avaiable if needed.
Code:
[tblPatrons] [tblRooms]
Code:
Private Sub cmdOk_Click()
'DoCmd.SetWarnings False
'run delete query to delete patron from tables
DoCmd.RunSQL "DELETE tblPatrons.*, tblPatrons.Room FROM tblPatrons " & _
"WHERE (((tblPatrons.Room)=[Forms]![frmVerify]![Room2]));"
'run update query to update room availability
DoCmd.RunSQL "UPDATE tblRooms SET tblRooms.Availability = 'Available'" & _
"WHERE (((tblRooms.Room)=[Forms]![frmVerify]![Room2]));"
DoCmd.Close
'DoCmd.SetWarnings True
DoCmd.SelectObject acForm, "frmHome"
DoCmd.Requery
DoCmd.RepaintObject
End Sub
Comment