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

Main Form and Sub Form For Data Entry 2

Status
Not open for further replies.

BOONEY

Technical User
Apr 15, 2003
13
ID
I am trying to use a main form and a sub form to enter data into 2 related tables.

The main table has the fields:

Date:
Line:
Shift:

The child table which has the following fields:

Date:
Line:
Shift:
Downtime Hours:
Reason Code:

For every 1 record in the main table, there could be multiple records in the chile table. The unique index (and primary key) for the main table is on the multiple fields of Date,Line and Shift. That is, every record in the parent table must have a unique date, line and shift.

I would like to use a main form and sub form for the purpose of entering data into the two tables. What I would like to have happen is once a Date, Line, and Shift is entered in the main table, these values would default to the date, line and shift values in the child table.

Then the user would only enter the downtime hours and reason code.

Please help if you can.

Thank you.
 
Hi

Access does this automatically for you, provided you set the Master\Child link fields properties of the subform control to the appropriate values, in your case Date;Line;Shift

May I also caution you against using reserved words (Date) as column or control names, it will end in tears

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Thank you Ken. I am still a little unclear however. Are you saying to set the control source for these fields to the master table date line and shift?

Could you please be a bit more specific as I am new to this.

Sorry for being a pain.

Mike
 
you are not a pain believe me. every has questions....

anyhow, what ken means is this:

in the design of your form, choose from the toolbar VIEW + PROPERTIES if your properties window is not already open. click once on the outline of the subform. the properties LinkChildFields and LinkMasterFields should both say something like:
Code:
Date;Line;Shift
or in that order, whatever you call each field in each of the two forms.
then you have text boxes on your parent form for date, line and shift. when you type data in them (when you are adding a new record) the same data is sitting and waiting for you in the child/subform to fill in the downtime hours and reason code. do you see that?
 
Ginger,

You are so nice. Thank you very much for your excellent help.


Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top