Passing information in tabs

C

Chris

Question

How do you link information to a subform when the subform is on a tab.

Scenario

from the main form I can select a client from a cbo box. I then go to
different forms and with the clientID I can update the clients info. I can
get the clientID linked with the form but I cannot link to the form when it
is in a sub form.

'frmNewMort1 is the tab form
'frmNewMort is the First page in the tab.

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmNewMort1"
DoCmd.OpenForm stDocName, , , stLinkCriteria

stLinkCriteria = "[ClientID]=" & Me![ClientID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
 
K

Kevin Sprinkel

If I understand you correctly, are you looking to load
another form, filtered by a value in your subform? If so,
use the code below, but refer to the control on the
subform. Your subform is itself a control on the main
form; you must go "through" it to get to one of ITS
controls. The reference is:

Me![nameofsubformcontrol].Form![nameofcontrolonsubform]

So if you have a control named txtClientID on a subform
named sbfClientDetail, the reference is:

Me![sbfClientDetail].Form![txtClientID]

HTH; if not post additional detail on what you're trying
to do.

Kevin Sprinkel
 
C

Chris

Hello Kevin, I'm not trying to filter the information from the sub form. My
main form contains the personal details of a client and links to a current
mortgage form, employment details form and a new mortgage form respectively.

My New mortgage section contains 5 forms so I have decided to put the
five forms on a tab system (probably wrong terminology).



From my main form I am selecting a clients name from a combo box and the
personal details for this client appear. When I open either the current
mortgage form or the employment details with the clients data (The client I
have selected in the cbo box) the data appears.



The problem - I want to open the form containing the tabs but I want the tab
system to contain the data of the client in the combo box.



The forms have been added to the tabs as sub forms.



I hope this clarifies what I am trying to do and that you can help.
Kevin Sprinkel said:
If I understand you correctly, are you looking to load
another form, filtered by a value in your subform? If so,
use the code below, but refer to the control on the
subform. Your subform is itself a control on the main
form; you must go "through" it to get to one of ITS
controls. The reference is:

Me![nameofsubformcontrol].Form![nameofcontrolonsubform]

So if you have a control named txtClientID on a subform
named sbfClientDetail, the reference is:

Me![sbfClientDetail].Form![txtClientID]

HTH; if not post additional detail on what you're trying
to do.

Kevin Sprinkel

-----Original Message-----
Question

How do you link information to a subform when the subform is on a tab.

Scenario

from the main form I can select a client from a cbo box. I then go to
different forms and with the clientID I can update the clients info. I can
get the clientID linked with the form but I cannot link to the form when it
is in a sub form.

'frmNewMort1 is the tab form
'frmNewMort is the First page in the tab.

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmNewMort1"
DoCmd.OpenForm stDocName, , , stLinkCriteria

stLinkCriteria = "[ClientID]=" & Me![ClientID]
DoCmd.OpenForm stDocName, , , stLinkCriteria


.
 
K

Kevin Sprinkel

Did you set the Link Child Fields and Link Master Fields
for the 5 subforms? The fact that they're on different
tabbed pages doesn't matter.

Another approach I often use for "main form" data details
is to place them in the form header--that way the same
information appears in all tabbed pages.

HTH
Kevin Sprinkel
-----Original Message-----
Hello Kevin, I'm not trying to filter the information from the sub form. My
main form contains the personal details of a client and links to a current
mortgage form, employment details form and a new mortgage form respectively.

My New mortgage section contains 5 forms so I have decided to put the
five forms on a tab system (probably wrong terminology).



From my main form I am selecting a clients name from a combo box and the
personal details for this client appear. When I open either the current
mortgage form or the employment details with the clients data (The client I
have selected in the cbo box) the data appears.



The problem - I want to open the form containing the tabs but I want the tab
system to contain the data of the client in the combo box.



The forms have been added to the tabs as sub forms.



I hope this clarifies what I am trying to do and that you can help.
If I understand you correctly, are you looking to load
another form, filtered by a value in your subform? If so,
use the code below, but refer to the control on the
subform. Your subform is itself a control on the main
form; you must go "through" it to get to one of ITS
controls. The reference is:

Me![nameofsubformcontrol].Form![nameofcontrolonsubform]

So if you have a control named txtClientID on a subform
named sbfClientDetail, the reference is:

Me![sbfClientDetail].Form![txtClientID]

HTH; if not post additional detail on what you're trying
to do.

Kevin Sprinkel

-----Original Message-----
Question

How do you link information to a subform when the
subform
is on a tab.
Scenario

from the main form I can select a client from a cbo
box.
I then go to
different forms and with the clientID I can update the clients info. I can
get the clientID linked with the form but I cannot link to the form when it
is in a sub form.

'frmNewMort1 is the tab form
'frmNewMort is the First page in the tab.

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmNewMort1"
DoCmd.OpenForm stDocName, , , stLinkCriteria

stLinkCriteria = "[ClientID]=" & Me![ClientID]
DoCmd.OpenForm stDocName, , , stLinkCriteria


.


.
 

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