How do I prevent more than one record being entered if combobox is a certain value?

sirantonycartwr

Registered User.
Local time
Today, 02:03
Joined
Dec 10, 2006
Messages
45
Hello everyone.
Here is a picture of one of my forms.
The idea is that, if the family tariff is selected the people subform will allow many records, else i want it to allow just one record.

form.JPG

Is there some VB code i can use which will allow one record and wont let anymore be created if something is selected?

Thanks, Ant...
 
Two solutions spring to mind. Either place a new button on the sub form that will not allow additions unless a control on your main form has a certain value or not. Or in the before update event of the subform you can place your validation.
 
Thank you for your quick reply (and solutions), the button solution sounds good.
Ill have a go. Thanks, Ant...
 
Ha ha, ive done it but it wont let me add a rcord now when there are no records present!
 
Last edited:
ok, Ive done the before update one. How do i make the before update event count how many records there are in the subform?
Ant...
 
the easiest way is to use DCOUNT - look it up the syntax in the help system
 
Last edited:
oh, ive already sorted it out, ive used "Form.Recordset.RecordCount" it works fine! now im trying to make a case statement accept "or" but it wont!
 

Users who are viewing this thread

Back
Top Bottom