AndyCompanyZ
Registered User.
- Local time
- Today, 00:30
- Joined
- Mar 24, 2011
- Messages
- 223
I have a piece of code (shown below) that is supposed to look at a field on a form (Me.ScheduledNumber) and compare it to another field (Me.CourseMInDel and Me.CourseMaxDel) and compare the values and give a message to the user if the results are, in the first case less than the CourseMInDel and in the second more than CourseMaxDel. the messagebox comes up for the first one always even if the number is more than the CourseMInDel. I have run through the code in the debugger and it shows the values which are correct from the form i.e. for instance 18 for ScheduledNumber and 14 for CourseMInDel but when I step through the code it runs the message and then exits the code (which it should if they were correct). If I have more than the CourseMaxDel in the
ScheduledNumber it still shows the first message.
ScheduledNumber it still shows the first message.
Code:
Private Sub EventDelegateListFinalised_Click()
If (Me.EventDelegateListFinalised.Value = -1) And (Me.ScheduledNumber.Value < Me.CourseMInDel.Value) Then
MsgBox "There are less than the minimum amount of delegates scheduled on this event.Please check before finalising"
Exit Sub
If (Me.EventDelegateListFinalised.Value = -1) And (Me.ScheduledNumber.Value > Me.CourseMaxDel.Value) Then
MsgBox "There are too many delegates scheduled on this event. Please check before finalising"
Exit Sub
End If
End If
DoCmd.OpenQuery "EventUpdate", acViewNormal, acEdit
End Sub