Ask Your Question

Field limits [closed]

asked 2016-05-22 18:05:51 +0200

cmccarter gravatar image

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?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2020-09-05 14:27:02.903357


Can you attach your database? It will be easy to help you. gravatar ( 2016-05-22 18:40:31 +0200 )edit

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

timelord gravatar imagetimelord ( 2016-05-22 20:23:06 +0200 )edit

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

cmccarter gravatar imagecmccarter ( 2016-05-23 19:46:50 +0200 )edit

2 Answers

Sort by » oldest newest most voted

answered 2016-05-23 13:19:19 +0200

jay Arr gravatar image

updated 2016-05-23 18:38:53 +0200

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 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


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

edit flag offensive delete link more


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

cmccarter gravatar imagecmccarter ( 2016-05-23 18:10:08 +0200 )edit

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

cmccarter gravatar imagecmccarter ( 2016-05-23 19:40:08 +0200 )edit

answered 2016-05-23 17:10:03 +0200

cmccarter gravatar image

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?

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2016-05-22 18:05:51 +0200

Seen: 637 times

Last updated: May 23 '16