Getting subform to work

D

Darlene

I have a Main Form which loads the Application Table then I have a button
that opens the Accidents Form. The Accident Form is a Subform, I want the
Applicant ID from the Main Form to display and then be able to load the
Accidents Table. When I press the button I get a blank form. I don't think
I have my settings right.
Any help would be appreciated.
 
K

Ken Snell \(MVP\)

What code or macro actions are you running when you click the button to open
the Accidents form? You say that the Accident form is a subform, so does
that mean that it's a subform in another main form? and are you opening that
other main form too?

Your description needs more details so that we can offer suggestions for how
to fix your issue.
 
D

Darlene

I'm doing an OpenForm with the following Arguments - Applicants, Form, ,
[Applicants]![Applicant ID]=[Accidents]![Applicant ID], Add, Normal

I created a Form using the wizard and included fields from Applicants and
Accidents Table and the wizard created an Applicants form and a Accidents
Subform.

I hope this additional information helps me get a solution.
 
K

Ken Snell \(MVP\)

From your description, it appears that the Accident subform is part of the
Applicants main form, which is the form that is already open when you click
the button. Therefore, the Accident subform should already be visible in
that form? Why do you want to open the subform again as a separate form?

Your current form should show the Accidents data based on the current
ApplicantID value in the main form, if the subform has been "connected" to
the main form -- though perhaps the wizard didn't do this. Open the main
form in design view, click on the top edge of the subform control, open the
Properties window, click on the Data tab, and look to see if Applicant ID
(this actual words Appllicant ID) is in the LinkChildFields and
LinkMasterFields properties. If this is not there in both properties, type
it into both properties so that the subform is "linked" to the main form.
--

Ken Snell
<MS ACCESS MVP>



Darlene said:
I'm doing an OpenForm with the following Arguments - Applicants, Form, ,
[Applicants]![Applicant ID]=[Accidents]![Applicant ID], Add, Normal

I created a Form using the wizard and included fields from Applicants and
Accidents Table and the wizard created an Applicants form and a Accidents
Subform.

I hope this additional information helps me get a solution.

Ken Snell (MVP) said:
What code or macro actions are you running when you click the button to
open
the Accidents form? You say that the Accident form is a subform, so does
that mean that it's a subform in another main form? and are you opening
that
other main form too?

Your description needs more details so that we can offer suggestions for
how
to fix your issue.
 
D

Darlene

Let's try this a different way.

I have a main form with a number of fields including Applicant ID. After
this form is completed I want to move to a second form for the same Applicant
ID and complete some additional fields.

What is the correct way to complete this?

Ken Snell (MVP) said:
From your description, it appears that the Accident subform is part of the
Applicants main form, which is the form that is already open when you click
the button. Therefore, the Accident subform should already be visible in
that form? Why do you want to open the subform again as a separate form?

Your current form should show the Accidents data based on the current
ApplicantID value in the main form, if the subform has been "connected" to
the main form -- though perhaps the wizard didn't do this. Open the main
form in design view, click on the top edge of the subform control, open the
Properties window, click on the Data tab, and look to see if Applicant ID
(this actual words Appllicant ID) is in the LinkChildFields and
LinkMasterFields properties. If this is not there in both properties, type
it into both properties so that the subform is "linked" to the main form.
--

Ken Snell
<MS ACCESS MVP>



Darlene said:
I'm doing an OpenForm with the following Arguments - Applicants, Form, ,
[Applicants]![Applicant ID]=[Accidents]![Applicant ID], Add, Normal

I created a Form using the wizard and included fields from Applicants and
Accidents Table and the wizard created an Applicants form and a Accidents
Subform.

I hope this additional information helps me get a solution.

Ken Snell (MVP) said:
What code or macro actions are you running when you click the button to
open
the Accidents form? You say that the Accident form is a subform, so does
that mean that it's a subform in another main form? and are you opening
that
other main form too?

Your description needs more details so that we can offer suggestions for
how
to fix your issue.

--

Ken Snell
<MS ACCESS MVP>


I have a Main Form which loads the Application Table then I have a
button
that opens the Accidents Form. The Accident Form is a Subform, I want
the
Applicant ID from the Main Form to display and then be able to load the
Accidents Table. When I press the button I get a blank form. I don't
think
I have my settings right.
Any help would be appreciated.
 
K

Ken Snell \(MVP\)

The VBA code that you'd run would be this (assuming that it's being run in
the main form or the subform, and that the name of the new form that is to
be opened is not the same as the form in which you are running this code):

DoCmd.OpenForm "NameOfSecondFormBeingOpened", , , _
"[Applicant ID]=" & Me.[Applicant ID].Value, acFormAdd


If you're wanting to use a macro to open this second form, the arguments
would be
Form Name: NameOfSecondFormBeingOpened
View: Form
Filter Name: < empty >
Where Condition: ="[Applicant ID]=" & [Applicant ID]
Data Mode: Add
Window Mode: Normal

If what you seek to do is to open a second copy of the same form in which
you're already working, the above code will not work. You'd need to use a
Form object to do that, but I doubt, based on your description, that that is
what you need to do here.

--

Ken Snell
<MS ACCESS MVP>



Darlene said:
Let's try this a different way.

I have a main form with a number of fields including Applicant ID. After
this form is completed I want to move to a second form for the same
Applicant
ID and complete some additional fields.

What is the correct way to complete this?

Ken Snell (MVP) said:
From your description, it appears that the Accident subform is part of
the
Applicants main form, which is the form that is already open when you
click
the button. Therefore, the Accident subform should already be visible in
that form? Why do you want to open the subform again as a separate form?

Your current form should show the Accidents data based on the current
ApplicantID value in the main form, if the subform has been "connected"
to
the main form -- though perhaps the wizard didn't do this. Open the main
form in design view, click on the top edge of the subform control, open
the
Properties window, click on the Data tab, and look to see if Applicant ID
(this actual words Appllicant ID) is in the LinkChildFields and
LinkMasterFields properties. If this is not there in both properties,
type
it into both properties so that the subform is "linked" to the main form.
--

Ken Snell
<MS ACCESS MVP>



Darlene said:
I'm doing an OpenForm with the following Arguments - Applicants, Form,
,
[Applicants]![Applicant ID]=[Accidents]![Applicant ID], Add, Normal

I created a Form using the wizard and included fields from Applicants
and
Accidents Table and the wizard created an Applicants form and a
Accidents
Subform.

I hope this additional information helps me get a solution.

:

What code or macro actions are you running when you click the button
to
open
the Accidents form? You say that the Accident form is a subform, so
does
that mean that it's a subform in another main form? and are you
opening
that
other main form too?

Your description needs more details so that we can offer suggestions
for
how
to fix your issue.

--

Ken Snell
<MS ACCESS MVP>


I have a Main Form which loads the Application Table then I have a
button
that opens the Accidents Form. The Accident Form is a Subform, I
want
the
Applicant ID from the Main Form to display and then be able to load
the
Accidents Table. When I press the button I get a blank form. I
don't
think
I have my settings right.
Any help would be appreciated.
 

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