Limit Records in a Subform

G

Guest

I have a subform as a datasheet within a form. I want to limit the number of
subform records that a user can edit to three for each main form record. Any
suggestions?

Thank You for your time in advance...
 
S

strive4peace

on BeforeInsert event of subform

if me.recordset.recordcount >= 3 then
msgbox "You may not add any more records",,"Cannot Add
record"
cancel = true
me.undo
end if


Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access
strive4peace2006 at yahoo.com
 

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