Access 2010 update a continuous form if field value in ALL rows is equal to "Confirmed"
Posted on 2013-01-21
I have a cmdButton on a continuous form that I want to use to update another table only if the field named "txtBookingStatus" in ALL rows is equal to "Confirmed".
Private Sub cmdCloseBooking_Click()
On Error Resume Next
If Me.txtBookingStatus = "Confirmed" Then
MsgBox "You need to update the Booking Status for all customers before you can continue"
'UPDATE tblHASchedules.Status as "Closed"
DoCmd.RunSQL "UPDATE tblHASchedules SET tblHASchedules.Status = 'Closed' " & _
"WHERE tblHASchedules.HASchedule_ID=" & Me.txtHASchedule_ID & ";"
DoCmd.Close acForm, "frmGSDetails"