Limiting Records on a subform

velcrowe

Registered User.
Local time
Today, 14:45
Joined
Apr 26, 2006
Messages
86
I would like to limit the number records entered per main form on my subform. Is this possible? For instance, for every order placed, I only want the customer to add three items and their descriptions the subform. ;)
 
Use the RecordCount method in the OnCurrent Event, oops silly me, this post doesn't meet the new rules
 
Here is a good reference as far as using this sort of technique:

http://www.access-programmers.co.uk/forums/showthread.php?t=137158

Specifically quoting the example above, if I wanted to limit the number of line items on the invoice (the subform on the main form), I would put something like this on the "add line item" button;
Code:
if me.SubFormContainer.form.recordsetclone.recordcount = 3 then
  msgbox "This order has been fulfilled, please submit the order to place another."
    exit sub
end if
 
You can of course use the OnCurrent event of the subform in conjunction with Cancel=True with the previous example but maintaining the inbuilt nav buttons
 

Users who are viewing this thread

Back
Top Bottom