AndyCompanyZ
Registered User.
- Local time
- Today, 12:12
- Joined
- Mar 24, 2011
- Messages
- 223
I have now changed routine and now have:
Dim i As Integer
Dim db As DAO.Database
Set db = CurrentDb
i = DCount("DelegateID" , "tblEventDelegate" , "DelegateID & EventID = [forms]![CoursesDelegate]![DelegateID] & [forms]![CoursesDelegate]![EventID]")
If DelegateID <> "" And Me.EventID <> "" Then
If i > 0 Then
MsgBox i & " This delegate is already scheduled on this course" & vbCrLf & "Please check individual's course needs before entry.", , "System Notice"
Cancel = True
Me.Undo
Exit Sub
End If
Else
This now brings up the message box no matter what I enter which I think is because it says whatever is selected from the combobox will produce the message. I want it to look up the table and see if a record exists for an instance of both the eventId and the delegateID in the eventdelegate table but can't see how to do this.
Dim i As Integer
Dim db As DAO.Database
Set db = CurrentDb
i = DCount("DelegateID" , "tblEventDelegate" , "DelegateID & EventID = [forms]![CoursesDelegate]![DelegateID] & [forms]![CoursesDelegate]![EventID]")
If DelegateID <> "" And Me.EventID <> "" Then
If i > 0 Then
MsgBox i & " This delegate is already scheduled on this course" & vbCrLf & "Please check individual's course needs before entry.", , "System Notice"
Cancel = True
Me.Undo
Exit Sub
End If
Else
This now brings up the message box no matter what I enter which I think is because it says whatever is selected from the combobox will produce the message. I want it to look up the table and see if a record exists for an instance of both the eventId and the delegateID in the eventdelegate table but can't see how to do this.