Numpty
on t'internet
- Local time
- Today, 17:02
- Joined
- Apr 11, 2003
- Messages
- 60
I have a form [BookedCourse]which displays details relating to a courses. Within this form there is a subform which allows people known as [Delegates] to be booked onto the course.
The subform is based on a link table or intersection table between [BookedCourse] and [Delegates].
Table: BookedCourse/DelegateLink
Primary Key: BookedCourse/DelegateLinkID
DelegateID
BookedCourseID
The subform allows duplicate Delegates to be booked onto a course but obviously this should not be allowed. I've tried for the last couple of days to tinker with this, using this forum to help, but no luck as yes.
This is the code I have come up with so far in the before update event of the subform.
If DCount("[DelegateID]", "Delegate/BookedCourse Link", "[DelegateID] = " & _
Me![DelegateID] & " AND [BookedCourseID], = " & Me![BookedCourseID] > 0) Then
MsgBox "Error", vbOKOnly, "This Delegate is already booked on this course"
End If
When this code executes it will display the error message ven if the Delegate entered is not a duplicate. i.e I have cleared the link table of all entries - booked one delegate onto a course OK but then when a book a different delegate it displays the error message.
Hope someone can help.
The subform is based on a link table or intersection table between [BookedCourse] and [Delegates].
Table: BookedCourse/DelegateLink
Primary Key: BookedCourse/DelegateLinkID
DelegateID
BookedCourseID
The subform allows duplicate Delegates to be booked onto a course but obviously this should not be allowed. I've tried for the last couple of days to tinker with this, using this forum to help, but no luck as yes.
This is the code I have come up with so far in the before update event of the subform.
If DCount("[DelegateID]", "Delegate/BookedCourse Link", "[DelegateID] = " & _
Me![DelegateID] & " AND [BookedCourseID], = " & Me![BookedCourseID] > 0) Then
MsgBox "Error", vbOKOnly, "This Delegate is already booked on this course"
End If
When this code executes it will display the error message ven if the Delegate entered is not a duplicate. i.e I have cleared the link table of all entries - booked one delegate onto a course OK but then when a book a different delegate it displays the error message.
Hope someone can help.