Can this be done? How to...

G

Guest

Hello,

In my application, I have users entering data on a form (think a master
employee record). When the user clicks the submit button to save this
information, I would like a 2nd form to open for related data going to a
different table. The 1st form has three fields (foreign key) and 2 others,
the last 2 of which may or may not have data. I would like to open the 2nd
form and pass the data from these fields directly to the appropriate fields
on the 2nd form.

The data to be passed will be the PK/FK from the first form. This data must
always exist. The other 2 fields, each may or may not have data to pass.
Either way, the new record from the 2nd form must be added to the 2nd table.
After the data entry is complete, this form is simply closed, saving the
record, then the first form will close, completing its save.

Can this be done, and if so, how?

TIA,
Rich
 
G

Guest

Here is a little more detail on what I am trying to accomplish. Basically,
track where a new employee is in the hiring process.

The first form will have general employee info (EmpID, FNAme, LName,
Start_Date, Paperwork_Submit_Date, other dates...). The EmpID is the PK of
the Master Emp Record and FK to the 2nd form/table. The 2nd form/table has a
column for each stage of the hiring process, which are checkpoints.

In MANY (but not all) cases, when completing the master form, the
Start_Date and Paperwork_Submit_Date will be known. Along with the PK/FK
(EmpID), I would like to pass these other 2 dates to the matching fields on
the second form. As the employee moves through the hiring process, the
remaining checkpoint dates will be added using the 2nd form.

HTH's to clear up my dilema.
 
J

John W. Vinson

Hello,

In my application, I have users entering data on a form (think a master
employee record). When the user clicks the submit button to save this
information, I would like a 2nd form to open for related data going to a
different table. The 1st form has three fields (foreign key) and 2 others,
the last 2 of which may or may not have data. I would like to open the 2nd
form and pass the data from these fields directly to the appropriate fields
on the 2nd form.

Why?

I don't see any reason to store this data redundantly in a second table.
What's your rationale for doing so?

By far the simplest way to store the related data would be to use a subform;
use the linking field (EmployeeID??) as the master/child link field. No code
needed, and both the parent and child records will automatically be saved when
you move to a new record or close the form.

John W. Vinson [MVP]
 
A

Albert D. Kallal

from the first form, just use the follwig code to launch the 2nd form, and
set the values you want:

me.Refresh ' write data to disk
docmd.OpenForm "MyF2",,,, acFormAdd
forms!myF2!FK = me!ID
forms!myF2!MyField1! = me!Field1
forms!myF2!MyField2! = me!Field2

Make the 2nd form model,, and thus the user will have to close the form to
return to this form...

when the user closes the 2nd form, that data will be saved...
 

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