Hey, sorry I didn't know where to post this so thought I'd do it in the general thread.
I'm a beginner to Access and not done coding before, my mate helped me with some code to use in my database for a hotel booking system. The code I got is:
Private Sub Command35_Click()
On Error GoTo Err_Command35_Click
Dim stDocName As String
stDocName = "Room Info"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_Command35_Click:
Exit Sub
Err_Command35_Click:
MsgBox Err.Description
Resume Exit_Command35_Click
End Sub
My question is how do I make an error box appear when someone types in a room number that isn't in the database? (rooms are 100 - 125) I want it to say this room is not available or does not exist.
Also, if anyone can explain what the code above does as I'm clueless with this thing but have got an interest for it.
I'm a beginner to Access and not done coding before, my mate helped me with some code to use in my database for a hotel booking system. The code I got is:
Private Sub Command35_Click()
On Error GoTo Err_Command35_Click
Dim stDocName As String
stDocName = "Room Info"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_Command35_Click:
Exit Sub
Err_Command35_Click:
MsgBox Err.Description
Resume Exit_Command35_Click
End Sub
My question is how do I make an error box appear when someone types in a room number that isn't in the database? (rooms are 100 - 125) I want it to say this room is not available or does not exist.
Also, if anyone can explain what the code above does as I'm clueless with this thing but have got an interest for it.