Code Help Please

K

Kevin D.

I have an Event database where I keep track of the number of people sitting
at a table. I'm trying to write some code where when a table is assigned to
an attendee, a count will be done of the number of people assigned to that
table and if it exceed the table maximum a message box would appear with a
warning.

The table maximum is stored in the "Setup" Table in a field called "TableMax".

Each attendee is assigned a table # stored in the Field "TableNumber" in
the"tblAttendeesAll" Table. A field called "NumberInParty" stores the number
of people in each party, 1 for singles and 2 for couples.

So I need some code that when a table is assigned to an attendee sums the
"NumberInParty" Field for each entry at that "TableNumber" in Table
"tblAttendeesAll" and compares this number with the number stored in the
"TableMax" field in the "Setup" Table to see if it is more than or less than
the tablemax setting.

Sorry to be so long winded. Any help is greatly appreciated.
 
J

Jeff Boyce

Kevin

One approach might be to prevent adding the new person if the TableMax is
already reached. If your code counted the number of folks signed up at each
table, you could hide the Table in your form's combo box that lists
"available tables".

You'd do that with a query that returns all Tables where the total number
signed up for the table is less than TableMax. This sounds like a "Totals"
query to me.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Top