Limit rows in subform based on field in main form

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!!!
 
T

Tom van Stiphout

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
 
T

Tom van Stiphout

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
 
C

cynteeuh

Pieter is correct in what I meant. Sorry for any confusion. I'll definitely
give this a try.

Thank you!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top