Limit rows in subform based on field in main form

  • Thread starter Thread starter cynteeuh
  • Start date Start date
C

cynteeuh

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!!!
 
On Tue, 2 Mar 2010 15:50:01 -0800, cynteeuh

In some subforms users can sort the data differently, so just making
the top N rows editable is not going to be good enough. How will we
know which rows you mean?

In general terms you can write code in the subform's Form_Current
event and set Me.AllowEdits to True or False based on if it's in the
first N rows or not.
Me.RecordsetClone.AbsolutePosition can be used to get the 0-based row
count.

-Tom.
Microsoft Access MVP
 
On Wed, 03 Mar 2010 02:09:55 GMT, "PieterLinden via AccessMonster.com"

Interesting. I took his question to mean: I may have more than N
records, and the user can only enter data in the first N ones.
You took it to mean: I want to prevent the user from entering more
than N rows.

-Tom.
Microsoft Access MVP
 
Pieter is correct in what I meant. Sorry for any confusion. I'll definitely
give this a try.

Thank you!!!
 
Back
Top