Prevent new additions to a subform before completing main form

J

John B

Hi,
I am tryin to prevent new additions in a subform, if the main form has no
record, without success.
Main Form name: "Order"
then
Tab Control name: "Order details"
Tab page name: "Order List" (it is a subform)
Tab page name: "Name List" (it is a subform)

On the current event of the "Order" form:
Me!Order List.Form.AllowAdditions = Not Me.NewRecord
Me!Name List.Form.AllowAdditions = Not Me.NewRecord

But I have a 438 run-time error when I open the form. (Access 2003)

Any help please.
Thanks and Regards
John
 
R

Rick Brandt

John said:
Hi,
I am tryin to prevent new additions in a subform, if the main form
has no record, without success.
Main Form name: "Order"
then
Tab Control name: "Order details"
Tab page name: "Order List" (it is a subform)
Tab page name: "Name List" (it is a subform)

On the current event of the "Order" form:
Me!Order List.Form.AllowAdditions = Not Me.NewRecord
Me!Name List.Form.AllowAdditions = Not Me.NewRecord

But I have a 438 run-time error when I open the form. (Access 2003)

Any help please.
Thanks and Regards
John

Object names with spaces (bad habit) need to be surrounded with square
brackets.
 
M

Michael Gramelspacher

Hi,
I am tryin to prevent new additions in a subform, if the main form has no
record, without success.
Main Form name: "Order"
then
Tab Control name: "Order details"
Tab page name: "Order List" (it is a subform)
Tab page name: "Name List" (it is a subform)

On the current event of the "Order" form:
Me!Order List.Form.AllowAdditions = Not Me.NewRecord
Me!Name List.Form.AllowAdditions = Not Me.NewRecord

But I have a 438 run-time error when I open the form. (Access 2003)

Any help please.
Thanks and Regards
John

If you type Me.Order, you should see that the name of the subform is Order_List.
The same goes for Name List being Name_List.

Me.Order_list.Form.Allowadditions = Not Me.NewRecord
Me.Name_list.Form.Allowadditions = Not Me.NewRecord

There may also have to be code in the AfterInsert Event

Me.Order_list.Form.Allowadditions = True
Me.Name_list.Form.Allowadditions = True
 

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