ZerØ Coder
Beta member
- Messages
- 1
Hey there, I have written a bit of code for a coursework task.
but I'm having a problem in it throwing up the right error message.
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim MsgBoxTxt As String
Dim Places As String
Places = DCount("*", "Booking", "[Course ID] = ComboCourseID")
If DCount("*", "Booking", "[Course ID]=ComboCourseID") < 20 Then
MsgBoxTxt = "Course is Booked with " & Places & " Customers and there are " & 20 - Places & " places left."
Else
MsgBoxTxt = "Course is full with " & Places & " places taken out of 20. Sorry, this booking cannot be made."
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
End If
If DCount("*", "Booking", "[Course ID]=ComboCourseID and [Customer ID] = FormCustomerID") >= 1 Then
MsgBoxTxt = "Customer has already booked on this course"
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
End If
MsgBox MsgBoxTxt
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
End Sub
The error message it is showing at the moment is underlined but the one it should be showing is in bold
I would much appreciate it if someone could get back to me with an answer thank you!
but I'm having a problem in it throwing up the right error message.
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim MsgBoxTxt As String
Dim Places As String
Places = DCount("*", "Booking", "[Course ID] = ComboCourseID")
If DCount("*", "Booking", "[Course ID]=ComboCourseID") < 20 Then
MsgBoxTxt = "Course is Booked with " & Places & " Customers and there are " & 20 - Places & " places left."
Else
MsgBoxTxt = "Course is full with " & Places & " places taken out of 20. Sorry, this booking cannot be made."
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
End If
If DCount("*", "Booking", "[Course ID]=ComboCourseID and [Customer ID] = FormCustomerID") >= 1 Then
MsgBoxTxt = "Customer has already booked on this course"
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
End If
MsgBox MsgBoxTxt
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
End Sub
The error message it is showing at the moment is underlined but the one it should be showing is in bold
I would much appreciate it if someone could get back to me with an answer thank you!