Setting up a count to restrict registrations

  • Thread starter Thread starter Jordan Hiebert
  • Start date Start date
J

Jordan Hiebert

I'm constructing a database for a summer camp and I need to be able to
allow only a certain number of male and female registrations per camp
session as well as only a certain number of waterskiing and
wakeboarding campers per session. Right now I have a form that uses a
dropdown to select a camp session and checkboxes for waterskiing and
wakeboarding. How can I implement the above limits to display a
msgbox() when a camp session is full or waterskiing or wakeboarding is
full for that session?
 
Jordan Hiebert said:
I'm constructing a database for a summer camp and I need to be able to
allow only a certain number of male and female registrations per camp
session as well as only a certain number of waterskiing and
wakeboarding campers per session. Right now I have a form that uses a
dropdown to select a camp session and checkboxes for waterskiing and
wakeboarding. How can I implement the above limits to display a
msgbox() when a camp session is full or waterskiing or wakeboarding is
full for that session?
You'd need to store the upper limit number in a table, then in the form's
Before Update event, count the number of records in the form's recordset
and compare it with the stored value (untested):

Dim rs as Recordset 'You may want to define DAO.Recordset or ADO.Recordset
there
Set rs = Me.RecordsetClone
If rs.RecordCount > DLookup("MyField","tblMyTable") Then
'Message box warning here
Cancel = True
End If
rs.Close
Set rs = Nothing

"MyField" and "tblMyTable" are where your stored total is.

HTH - Keith.
www.keithwilby.com
 
Back
Top