Automatically Fill in Field

G

Guest

I have a form (frmEmployee) and a subform (frmDependants). A One-to-Many
relationship has been established for the SSN fields in their respective
tables.
Is there a way to have a the SSN field in frmDependants automatically
populate with the data shown in the SSN field on frmEmployee when a new
record is added (to frmDependants)?

Thanks!
 
G

Guest

You need to link the Main form and the su form using the Parent and Child
properties of the sub form control within the main form, use the SSN fields
name n both.
Doing that will move the value from the main form to the sub form.
 
G

Guest

Thanks for the help. I'm new using Access and I'm seeing that I don't quite
have the terminology correct.
I followed your suggestion, and I now believe that I'm not actually working
with subforms.
What I have is a form (frmEmployee) with a command button that launches
another form (frmDependants). Is there a way to get these two to link?

Thanks again!
 
G

Guest

When you open the second form, pass to it the SSN filter from the first form,
and you can use the OpenArgs to pass a value to the second form

Dim MyFilter as String, MyOpenArgs As String
MyOpenArgs = Me.SSN
MyFilter = "[SSN] = '" & Me.SSN & "'"
Docmd.OpenForm "frmDependants" , , , MyFilter , , , MyOpenArgs

On the second form you can use the SSN you passed using the OpenArgs, on the
OnLoad event of the form.

Me.SSN = Me.OpenArgs
 

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