Comparing data from a subform and form

J

Jeffrey Marks

I currently have a form that shows the number of participants allowed
to attend a particular event. This field is displayed on the sign-up
form for the event. The same form has a subform which does the sign-up
(creating a many to many relationship record between participant and
event).

The users would like to count the number of participants on the
subform who have signed up against the number of participants allowed
field in the main form and flash a message of "FULL" if the
participants reaches the number allowed. (They still want to be able
to add more at their own discretion.)

I've never compared fields between form and subform before, and wasn't
sure about how to go about it.

Thanks

Jeff
 
J

John W. Vinson

I currently have a form that shows the number of participants allowed
to attend a particular event. This field is displayed on the sign-up
form for the event. The same form has a subform which does the sign-up
(creating a many to many relationship record between participant and
event).

The users would like to count the number of participants on the
subform who have signed up against the number of participants allowed
field in the main form and flash a message of "FULL" if the
participants reaches the number allowed. (They still want to be able
to add more at their own discretion.)

I've never compared fields between form and subform before, and wasn't
sure about how to go about it.

Thanks

Jeff

One way would be to put a textbox txtSignedCount on the Footer of the subform,
with a control source =Count(*). This will count the number of records signed
up for this event.

Then you can put another textbox on the mainform with a control source

=IIF(Me!EventSize > Me!subformname.Form!txtSignedCount, Null, "FULL")

Set its format to display in red 30 point type or whatever is apropos.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top