Link a subform to a subform in a Tab control (1 Viewer)

dpalai

New member
Local time
Today, 02:26
Joined
Aug 15, 2012
Messages
6
MS ACCESS 2000

Hi All,

Short question: Is it possible to link a subform to a subform when both of them are in the same tab control?

I try to make a database to store information about existing birds in a Ramsar area, aiming to donate it to a local non-govermental organisation.

There are 3 tables:
Table 1: "BirdsTbl", PK BirdID
Table 2: "ReportsTbl", PK ReportID, FK BirdID
Table 3: "MultimediaTbl", PK MediaID, FK ReportID
Tables are linked as discribed above.

In a form, I have a Tabcontrol with 4 pages.
Page1 and Page2 host the controls of "BirdsTbl" (The main table)
Page 3 hosts the controls of "ReportTbl" and is linked to the page 1 as a Subform (I have designed the subform on the basis of ReportsTbl, I droped it in page 3 and made the connections accordingly)..

Now, I'd like to place
on page 4 a new subform which is made on the basis of table "MultimediaTbl" and to link it to subform on page 3.
I
have tried to use the same procedure as in page 3 subform, but without success. The master field ReportID was not present.

Is there a way to achieve this?

Thank you in advance

Dimitris
 

Beetle

Duly Registered Boozer
Local time
Today, 03:26
Joined
Apr 30, 2011
Messages
1,808
You use a hidden text box on the main form to return the ReportID from the Report sub form, then reference that text box in the Master/Child link of the Subform Control for the Multimedia sub form. See post #5 from this thread for an example file if you want.
 

dpalai

New member
Local time
Today, 02:26
Joined
Aug 15, 2012
Messages
6
Dear Beetle

Thank you for your response.

Allthow the sample database you mentioned is not warking for me (probably due to a version issue, I use Access 2000), I will try to realize your tip and I'll let you know.

Dimitris
 

dpalai

New member
Local time
Today, 02:26
Joined
Aug 15, 2012
Messages
6
Dear Beetle

I’ve tried to realize your tip but with no success.

Some additional information and a brief description of my effort:



Name of hidden Textbox control: HiddenBox
Name of the tab page where the Hiddenbox ist: MainPage
Name of the tab page where the Report subform is: ObservReportsSubfrm
Control source for HiddenBox: =ObservReportsSubfrm.Form!RepID
It works fine.


On the Multymedia subform:

Child fields link: MediaID
How should I refer to HiddenBox content in the Master Fields link?
I’ve tried: =MainPage.Form!Hiddenbox or =MainPage.Form!Hiddenbox.text but with no success. Access ask me to define a parameter. Even the navigation buttons in the Multimedia subform are disabled.

Could you please advise me about this?

Thank you in advance

Dimitris
 

vbaInet

AWF VIP
Local time
Today, 10:26
Joined
Jan 22, 2010
Messages
26,374
Just type in the name of the textbox in the Link Master Fields property. Remember, type it in because you can't select it from the dialog box.
 

dpalai

New member
Local time
Today, 02:26
Joined
Aug 15, 2012
Messages
6
Thank you very much! It works perfectly. But.....

How can I update now the bound field ReportID which should have the same value as the value of the HiddenBox?
I've tried with VBA code without success.
Allow me to remind you that ReportID is the FK of the MultimediaTbl.

Thank you in addvance!

Dimitris
 

Beetle

Duly Registered Boozer
Local time
Today, 03:26
Joined
Apr 30, 2011
Messages
1,808
Not sure I'm following you here. If you've correctly set up the Master/Child link then that will automatically manage the ReportID foreign key field in the Multimedia sub form. Can you explain the problem in a bit more detail?
 

dpalai

New member
Local time
Today, 02:26
Joined
Aug 15, 2012
Messages
6
Dear Beetle

Τhe following describes what I have done:

The relations between the tables are as indicated in my first post.
The name of the form that hosts the tab control is "Birds"
The name of the tab control is "TabCtl0"
The first page of the tab control is named "MainPage"
In this page I have placed the hidden textbox the name of which is "HiddenBox"
In the source field of HiddenBox I have typed "=ObservReportsSubfrm.Form!RepID" aiming to retrieve the current ReportId number from the first subform named "ObservReportsSubfrm" which is on the third page of the tab control, named "ReportsPage". This procedure works fine, meaning by that that the value of HiddenBox equals the ReportId.
The fourth page has the name "MediaFiles" and hosts the sub-subform named "MediaFrm".
In the Link Master Fields I typed "HiddenBox" and in the Link Childe Fields
"MediaID". In this form I have a bound field named "ReportID" which is the FK of the first subform. This ReportID field remains always blank and so it is not possible to update the corresponding Table.

I apologize for any inconvenience.

Thank you in advance

Dimitris
 

Beetle

Duly Registered Boozer
Local time
Today, 03:26
Joined
Apr 30, 2011
Messages
1,808
...in the Link Childe Fields
"MediaID"...

That's your problem. The Child field of the link should be ReportID.
 

dpalai

New member
Local time
Today, 02:26
Joined
Aug 15, 2012
Messages
6
Yes! That was my problem. Now everything works OK!

Thank you very much for the time you spent and for your kindness.

Dimitris
 

Users who are viewing this thread

Top Bottom