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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Force data entry in subform 2

Status
Not open for further replies.

jollibee

IS-IT--Management
Mar 31, 2001
2
PH
I am new to Microsoft Access.

Problem : I want to force the user to enter data in a subform (invoice details) after entering data in the parent form (invoice header).

What I have done so far : I tried to disable the navigation keys of the parent form when the user enters the subform and enable it after the user leaves the subform. However, after going in the subform, if the user clicks on the parent form without entering data in the subform, then the navigation keys of the parent form appears in which he can click on next and previous record/invoice. This leads to a runtime error later because the invoice header does not have any associated invoice details.

TIA.
 
Jollibee,
This might be a little bit more complicated that what you are looking for...but if you have navigation buttons written into your form, couldn't you modify the code on the forward button to check to see if those values are null before continuing? Just a little If Then Else logic required. Hope that helps.

V
 
A possibility: Similar to Vman's suggestion(I think), use your own buttons to navigate records(disable any built in to the form),but check for valid data in the current record before going to the next record. Or you can use the AfterUpdate or OnExit property of the Subform field to validate the data, and don't let them leave the field until its filled in.
I'm curious why you're using a subform. Are the invoice header and invoice detail in seperate tables?
 
To TheVman and AArt,

Thanks for the reply. I tried a solution similar to what you suggested and it works. There are two tables involved, one is for storing the invoice information/header (date, sold to, etc) while the other table is for the invoice details (qty, unit price, desc, etc).

I was wondering if there is an MSAccess built-in validation that will prevent you from committing the invoice header record if there is no associated invoice detail record.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top