Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to keep subform editable when entering new record? 2

Status
Not open for further replies.

rockfish12

Technical User
Feb 12, 2002
31
0
0
US
I've got a form - "Orders" - that has a subform called "Order Items." I've set the On Current property of the Orders form to disallow edits (e.g. Me.AllowEdits = False) in order to prevent accidental editing (the user can bypass this by pressing an "Edit" button).

I've also got a "New" button that allows users to enter new orders in the form. However, I've noticed that when a user is entering a new order and tabs into the Order Items subform, the AllowEdits property from the main form seems to take control and disallows edits in the subform.

Any ideas on how to keep the subform editable when entering a new record, without totally doing away with the accidental editing safeguards?
 
Hallo,

I think this is what's happening...

The Order Items form is probably based on a table which is linked to the Orders form with relational integrity. You won't be able to add an Order Item record without an associated Order record.

The order record is not created until you save the order or move to a different order, so you won't be able to create items.

When you click the New button, create a 'default' order record (using docmd.runSQL, or some other code way), then display it in the orders window. You'll then be able to add items to the order.

If you need help with the specifics, just ask,

- Frink
 
Or you might try setting up a system where the subform is not visible until the user says to save the order header data, which will create whatever index number you are using to identify the order (and link to the items). Once the index number has been created, make the subform visible.
 
Thanks, Frink and BSMan. Frink, you were spot on about what was happening. I implemented both of your ideas and my form works great now. Thanks again for the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top