Windows XP, MS Access 2000
=======================
I have a form (frmEvent) to enter information for a Program Event, and it
has a subform (sfrmEventAttendee) to enter the names of attendees. The
default view for the subform is Datasheet, and the attendee names are
selected using a combo-box control, and the attendee IDs are stored in a
table (tblEventAttendee), along with the Program Event ID.
According to requirements, there has to be at least one attendee/Program
Event.
My two questions are:
1. What event(s) in frmEvent will have the code to check that at least one
attendee was selected in sfrmEventAttendee? I can think of two - OnClose and
BeforeUpdate . Will these be sufficient?
2. Is DLookup the best way to check for it?
Thanks for your response.
-Amit
Allen Browne - 15 Jan 2005 03:43 GMT
You have a chicken'n'egg problem here:
- You cannot enter an Attendee, until the Event exists.
- It follows that you cannot require an Attendee before the Event can be
created.
Form_BeforeUpdate won't work. It would be possible to use Form_Unload to
OpenRecordset on an outer join query statement to identify any event that
has no attendee. (The Unmatched query wizard could create this query for
you.)

Signature
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
> Windows XP, MS Access 2000
> =======================
[quoted text clipped - 18 lines]
>
> -Amit