Solved Limit the record in subform based of form filed number

theinviter

Registered User.
Local time
, 23:17
Joined
Aug 14, 2014
Messages
273
Dears;
I need a help,
I have a form named : clinic
Subform form: Delivery_Date
so there a field in clinics form named (Number of delivery) ,
so i want to limit the number of record in subform based on the number in main form.
for Example, if (Number of delivery) = 3 then the user can add only 3 records in subform.

so how can we do this?
 
Perhaps some code in the subform form after update event to check number of records in the subform and if it equals 3 or whatever number on the main form changed the subform allow additions property to no which should hide the ‘new record’ row
 
Perhaps some code in the subform form after update event to check number of records in the subform and if it equals 3 or whatever number on the main form changed the subform allow additions property to no which should hide the ‘new record’ row
can you advise about it
 
To check number of records use

me.recordset.count or dcount

To change the setting
Me.allowadditions=false
 
Something like this might work in the subform after update event

me.allowadditions=me.recordset.recordcount<parent.txtMaxnum
 

Users who are viewing this thread

Back
Top Bottom