Field limits

I have 2 tables built. one is called visitors and has all my visitor info. the other table is called sessions and has a list of classes that will be presented and the max size of the class. Each visitor has the option of selecting 3 classes, one for each session. I need to limit the number of visitors in some of the classes due to room size and other matters. Is this possible? or will I just have to keep track and not go over my limit manually?

Can you attach your database? It will be easy to help you.

Please do not attach if it contains personal information about your visitors.

It is just generic right now. how do I attach it? tried dragging to comment window but don’t think that worked

Presumably you are creating records that have the visitorID & ClassID. I would have a flag field on the class record (named islimited) set to TRUE of there is a limit on the number of visitors for the class & set to FALSE if there is not. I would also have another (integer) field (named numberRemaining which has the remaining number of visitors for the class. then I would use the following logic in a macro BEFORE I created the visitorID+ClassID record.

  1. Is this a limited class i.e. is the islimited flag set to TRUE
  2. if yes then is the numberRemaining >0
  3. if yes decrement the numberRemaning by 1, update the class record & create the visitorID+ClassID record.
  4. is this a non limited class i.e.is the islimited flag set to FALSE - then create the visitorID+ClassID record.
  5. if the numberRemaining = 0 tell the user the class is full

Having these two extra fields has other benefits. You can readily determine:

  • which classes are limited and which are not by using a simple SQL filter on the islimited field
  • which classes are full with a simple
    SQL testing the numberRemaining
    field for zero
  • which classes have remaining spaces with a simple SQL testing the
    numberRemaining>0

HTH

I think to help you further it would be easier you could attach your database to a comment/reply as suggested by another respondent.

Not real sure about this. This is my sessions table Field
ID, Integer Primary Key
Class, Text (varchar)
Limited,yes/No ( Boolean)
Size limit,Integer
In my form for selecting the class is it possible to use an sql query to

  1. check to see if the class selected is full
  2. if full send a message
  3. if not full send a message witl number of slots left
    4 if not full enter the class in the form

Sorry missed that request to attach db. but cannot upload yet

tnx. I think i understand but wlll have to red thru this several times for it to sink in.

I presently have a table that I draw the classes from. I have a field showing max class size if any. then I need another field Boolean for if the class is limited or not. This much I get. i think I cna build the macro but where would I put it to run b4 the selection of class?