Link subforms to show active record

G

Guest

I have a form with two subforms, when the first subform has a record
highlighted, I would like the other subform to show the details of the active
or highlighted record. In newby speak, is this easily achieved? I have a
verison of the simple database I can email with instructions if this would
clarify what Im trying to do. Thanks Tim
 
E

Ed Warren

What you are describing is a set for forms linked

Form A --> Form B (subform) [detail records for A shown in B]
Form A --> Form C (subform) [Detail records for A shown in C]

What you are wanting is

Form A --> Form B (subform of A) --> Form C (subform of B)
Detail records for A shown in B and Detail records for B shown in C.


Ed Warren
 
G

Guest

Ed, yes, infact the database is a fault logging system, form A = caller
details, form B = Issues associated with active caller in A, and Form C =
detials of the active issue on form B.

Is this hard to achieve?

Thanks Tim

Ed Warren said:
What you are describing is a set for forms linked

Form A --> Form B (subform) [detail records for A shown in B]
Form A --> Form C (subform) [Detail records for A shown in C]

What you are wanting is

Form A --> Form B (subform of A) --> Form C (subform of B)
Detail records for A shown in B and Detail records for B shown in C.


Ed Warren


Timboo said:
I have a form with two subforms, when the first subform has a record
highlighted, I would like the other subform to show the details of the
active
or highlighted record. In newby speak, is this easily achieved? I have a
verison of the simple database I can email with instructions if this would
clarify what Im trying to do. Thanks Tim
 
E

Ed Warren

As always there are many way to 'skin this cat'.


1. Build Form B, with Form C as a subform
2. Build Form A, with Form B as a subform.

The 'gottcha' is that Access wants the 'master' form to be in single record
view so form A will be in single record and so will form B. After you
build the forms you can go back and put them back into multiple record views
(at least in Access 98, and 2000).

A better way is to 'syncronize the forms' . I got the following from
Microsoft. In this approach you have several forms open and when you change
the current record in one it automatically filters the records in the
related forms. A little code required, but I like the user interface
better.

open a module add the following function::

Function IsLoaded(ByVal strFormName As String) As Boolean

' Returns True if the specified form is open in Form view or Datasheet view.


Const conObjStateClosed = 0

Const conDesignView = 0


If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> conObjStateClosed
Then

If Forms(strFormName).CurrentView <> conDesignView Then

IsLoaded = True

End If

End If


End Function



add the following code to the oncurrent event of the "master form" (here I
have a 'child form [Client Data] I want to keep in sync with the "master
form" and I want to link using the [CNumber] Field.


Private Sub Form_Current()

stDocName = "CLIENT DATA"


stLinkCriteria = "[CNUMBER]=" & Me![CNUMBER]


If (IsLoaded(stDocName) = True) Then


Forms![CLIENT DATA].FilterOn = True

Forms![CLIENT DATA].Filter = stLinkCriteria

End If

End Sub



Now dress things up by adding a button to open Form B from Form A and then
one to open form C from From B and your good to go.




In Access 2000 + you can use a 'tabbed page' and using events link them the
way you want to.

Hope this helps

Ed Warren.


Timboo said:
Ed, yes, infact the database is a fault logging system, form A = caller
details, form B = Issues associated with active caller in A, and Form C =
detials of the active issue on form B.

Is this hard to achieve?

Thanks Tim

Ed Warren said:
What you are describing is a set for forms linked

Form A --> Form B (subform) [detail records for A shown in B]
Form A --> Form C (subform) [Detail records for A shown in C]

What you are wanting is

Form A --> Form B (subform of A) --> Form C (subform of B)
Detail records for A shown in B and Detail records for B shown in C.


Ed Warren


Timboo said:
I have a form with two subforms, when the first subform has a record
highlighted, I would like the other subform to show the details of the
active
or highlighted record. In newby speak, is this easily achieved? I
have a
verison of the simple database I can email with instructions if this
would
clarify what Im trying to do. Thanks Tim
 
G

Guest

Thank you Ed, will give this a go this afternoon. merry Xmas

Ed Warren said:
As always there are many way to 'skin this cat'.


1. Build Form B, with Form C as a subform
2. Build Form A, with Form B as a subform.

The 'gottcha' is that Access wants the 'master' form to be in single record
view so form A will be in single record and so will form B. After you
build the forms you can go back and put them back into multiple record views
(at least in Access 98, and 2000).

A better way is to 'syncronize the forms' . I got the following from
Microsoft. In this approach you have several forms open and when you change
the current record in one it automatically filters the records in the
related forms. A little code required, but I like the user interface
better.

open a module add the following function::

Function IsLoaded(ByVal strFormName As String) As Boolean

' Returns True if the specified form is open in Form view or Datasheet view.


Const conObjStateClosed = 0

Const conDesignView = 0


If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> conObjStateClosed
Then

If Forms(strFormName).CurrentView <> conDesignView Then

IsLoaded = True

End If

End If


End Function



add the following code to the oncurrent event of the "master form" (here I
have a 'child form [Client Data] I want to keep in sync with the "master
form" and I want to link using the [CNumber] Field.


Private Sub Form_Current()

stDocName = "CLIENT DATA"


stLinkCriteria = "[CNUMBER]=" & Me![CNUMBER]


If (IsLoaded(stDocName) = True) Then


Forms![CLIENT DATA].FilterOn = True

Forms![CLIENT DATA].Filter = stLinkCriteria

End If

End Sub



Now dress things up by adding a button to open Form B from Form A and then
one to open form C from From B and your good to go.




In Access 2000 + you can use a 'tabbed page' and using events link them the
way you want to.

Hope this helps

Ed Warren.


Timboo said:
Ed, yes, infact the database is a fault logging system, form A = caller
details, form B = Issues associated with active caller in A, and Form C =
detials of the active issue on form B.

Is this hard to achieve?

Thanks Tim

Ed Warren said:
What you are describing is a set for forms linked

Form A --> Form B (subform) [detail records for A shown in B]
Form A --> Form C (subform) [Detail records for A shown in C]

What you are wanting is

Form A --> Form B (subform of A) --> Form C (subform of B)
Detail records for A shown in B and Detail records for B shown in C.


Ed Warren


I have a form with two subforms, when the first subform has a record
highlighted, I would like the other subform to show the details of the
active
or highlighted record. In newby speak, is this easily achieved? I
have a
verison of the simple database I can email with instructions if this
would
clarify what Im trying to do. Thanks Tim
 

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

Similar Threads

Delete forms record and subforms record 2
Multiple subforms 0
PLS HELP~! Simple Question: Master & Child Link without subform 3
Subforms 8
Records in Subforms 1
SubForms 5
Subforms 1
form wizard for subforms 11

Top