2k7mmurtaza
New member
- Local time
- Today, 19:26
- Joined
- Mar 5, 2018
- Messages
- 5
I have a view bookings page where once customers make a booking it shows their list of all bookings they have made.

The issue that I am getting is it doesn't allow me to delete a selected record and only keeps deleting the record which is on the top despite selecting another record. I inserted an error message which doesn't delete past booking dates because of keeping them as historical records. I only want to be able to delete future tense bookings. How do i delete selected records?
This is my current coding to delete a booking

The issue that I am getting is it doesn't allow me to delete a selected record and only keeps deleting the record which is on the top despite selecting another record. I inserted an error message which doesn't delete past booking dates because of keeping them as historical records. I only want to be able to delete future tense bookings. How do i delete selected records?
This is my current coding to delete a booking
Code:
Private Sub btnDelete_Click()
If Day <= Now Then
MsgBox "Past booking dates are for historical records and cannot be deleted"
Else
Msg = "Are you sure you want to cancel booking"
Style = vbYesNo
Response = MsgBox(Msg, Style)
If Response = vbYes Then
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdDeleteRecord
Exit Sub
End If
If Response = vbNo Then Me.Undo
Exit Sub
End If
Exit_ErrHandler:
Exit Sub
End If
End Sub