Disable Addition of Records on Basis of a Control

F

Faraz A. Qureshi

I have a checkbox control in the MAINFORM "CLIENT" named INDIVIDUAL.
I want the SUBFORM "OWNERS", presented in a datesheet form, not to be
showing the starred new record entry row but allowing only a single record to
be entered if the control is Checked, otherwise allow multiple entries.

What piece of VBA would help in this regard?
 
T

Tom van Stiphout

On Tue, 23 Feb 2010 05:17:01 -0800, Faraz A. Qureshi

You MUST show the New Record row to enter the first record, so setting
AllowAdditions to False is not a good idea.
Perhaps in the subform's Form_AfterUpdate you can test for 1 record:
Me.AllowAdditions = (Me.RecordsetClone.RecordCount = 0)
Then repeat this code in the Form_Current event, so AllowAdditions is
set again when you move to another record on the main form.

-Tom.
Microsoft Access MVP
 

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