Hello All,
In a table/form, i'd like to make sure that each study ID has no more than 3 questionnaires. So, basically, in this particular table/form, the max count for each study ID should be 3. Any ideas on how to do? Thank you!
Hello All,
In a table/form, i'd like to make sure that each study ID has no more than 3 questionnaires. So, basically, in this particular table/form, the max count for each study ID should be 3. Any ideas on how to do? Thank you!
I don't think it can be done at the table level but should be easy enough if done at the form level. Any data being added to tables or existing data being edited should with a form anyway.
If this helped, please click the star at the bottom left of this posting and add to my reputation. Many thanks.
Bob Fitzpatrick
Further to Bob's assertion regarding forms:
If you're using a temp table like I was, you can check the number of records. This uses the form textbox control txtNPno as criteria for the count, and runs on the BeforeInsert event.
I guess you could do the same thing against your form or subform if it's a datasheet, or against your main table using your study ID as criteria.Code:If DCount("*", "tempNPitems", [NPno] = Me.txtNPno) > 6 Then MsgBox "Only six records allowed!", vbOKOnly Cancel = True End If
Last edited by Micron; 06-21-2016 at 10:17 AM. Reason: clarified event
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.