Two subforms, one based on selection in the other

  • Thread starter Thread starter atledreier
  • Start date Start date
A

atledreier

I have a master list of tags, with a related table of documents for
each tag.

I have a query that select relevant tags based on 'owners', and would
like a form that present all the relevant tags on the left, and the
relevant documents for the selected tag on the right.

TBL_Tag:
*TAG
Description
Area
misc....

TBL_DocRef:
*DocNo
*GenId

TAG and GenId are the related fields.
 
The ownership to tags is based on [area]. I have a table

TBL_Users_Area:
User
Area

A query returning the Documents and relevant tags:
(Some fields are named different from the earlier post, I translated
the field names for it to make sense to non-norwegian people :-) )

SELECT Doc_ref.Docid, Doc_ref.Genid_1, Doc_ref.Type
FROM (TBL_Bruker_Modul INNER JOIN Document ON TBL_Bruker_Modul.Modul =
Document.Area) INNER JOIN Doc_ref ON Document.Docid = Doc_ref.Docid
WHERE (((TBL_Bruker_Modul.Login)=getlogin()))
ORDER BY Doc_ref.Docid;

Another query returning documents and their descriptions only.

SELECT Document.Docid, Document.Description
FROM TBL_Bruker_Modul INNER JOIN Document ON TBL_Bruker_Modul.Modul =
Document.Area
GROUP BY Document.Docid, Document.Description, TBL_Bruker_Modul.Login
HAVING (((TBL_Bruker_Modul.Login)=Getlogin()));


The Getlogin function:

Public Function getlogin()
getlogin = Login
End Function

'Login' is a public variable set when the user start the application.

The 'Tag' field is set in stone, sadly. The data structure is set by
my client, since the underlying database is imported to a 3rd party
system on their end.
 
I have a master list of tags, with a related table of documents for
each tag.

I have a query that select relevant tags based on 'owners', and would
like a form that present all the relevant tags on the left, and the
relevant documents for the selected tag on the right.

TBL_Tag:
*TAG
Description
Area
misc....

TBL_DocRef:
*DocNo
*GenId

TAG and GenId are the related fields.

You'll need to take action on the reserved words, but if you want one
continuous subform dependent on another contionuous subform, you can use a
"relay" textbox. Put a textbox on the mainform named txtRelay with a Control
Source such as

=subformTags.[TAG]

The second subform would be based on tbl_DocRef, and would use GenID as the
Child Link Field and txtRelay as the Master Link Field. The subform wizard
won't offer this as an option but you can just type the name of the control
into the property.
 
Back
Top