Forcing data input in subform

J

jody

I have a main form call Company. Within this form I have
a nested subform called ShipInfo. The two forms are
linked using the field: CompanyID. I need the user to
fill in the ShipInfo subform for each company. Even
though I have required fields in the ShipInfo table, the
user can still enter data in the company form and totally
by-pass the ShipInfo subform. What code do I need to
implement so that it forces input in the subform?

Here is how my company and shipinfo tables are set up:

Company Table:
CompanyID (Autonum)
VCID (Text) (Required - This is a vender code ID)
CompName (Text)
**Unique index on VCID

ShipInfo Table:
ShipInfoID (Autonum)
CompanyID (Number) Required
ShipLookupID (Number) Required
**Unique index on CompanyID & ShipLookupID


Would appreciate any suggestions. Thanks much!
 
B

Bill Taylor

Just a guess but I would try the before update event of the main form and
use it to set the focus to a control in the subform and fill in a value of a
non-required field. and then set the cancel = true for the event. In theory
this will force the error to fill in the required fields in the subform. A
record will be started in the subform and require the other values. It could
still be possible to not save the subforms record but a burden for the user.
You could also trap this error and check for completeness of
form.........moving the focus to the next empty field.
 

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