View Single Post
  #2  
Old March 3rd, 2010, 02:09 AM posted to microsoft.public.access.forms
PieterLinden via AccessMonster.com
external usenet poster
 
Posts: 307
Default Limit rows in subform based on field in main form

cynteeuh wrote:
I have a main form that has a number field (this field inidcates the number
of seats available). I want the subform to only allow the user to enter data
in rows that are equal or less than than the number field in the main form.

please help with code and best place to enter.

many thanks!!!


You need to use a RecordsetClone to get the count of records in the subform.
Then in the BeforeInsert event, check that

If RecordsetClone.RecordCountMAX_CHILD_RECORDS Then
'MsgBox...
Cancel = True
End If

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201003/1