Master-Child Form Linkages

S

Scott

I've been trying to apply the excellent advice offered in this forum (eg,
John Vinson and TomU) but am, apparently doing something wrong. A little
assistance would be appreciated.

I have a Main Form with two unbound text boxes:
txtCustID
txtPetID
I have a number of subforms parked in tabbed sections (for simplicity, I'll
just deal with the first two).

The first tab has 'Clientinfo' information. It uses CustomerID as its
primary field. In the OnCurrent Event I have included this code:
Me.Parent!txtCustID = Me.CustomerID
I have not included anything in the Link Child Fields and Link Master Fields
properties of the subform/subreport because it actually seems to negate the
linkage.

The second tab has 'Petinfo' information. It uses PetID as its primary
field and has the CustomerID as a Long Integer. In the OnCurrent Event I
have included this code:
Me.Parent!txtPetID=Me.PetID
I 'have' used the Link Child Fields (CustomerID) and the Link Master Fields
(txtCustID) here.

Without delving into other problems, my immediate objective is to get the
CustomerID and PetID autonumbers--from the Clientinfo and Petinfo forms,
respectively--to actually be seen in the text boxes of the main form (i.e.,
in txtCustID and txtPetID). Toward that end I have tried to save the record
(ref. my 2/6 question with substantive responses by Al, Stefan and Bob), I
have tried using Me.Parent.Requery, Me.Requery, etc. None of this seems to
work quite right.

If I can understand this better, I hope that I can then address some other
issues relating to the other forms (not discussed here). Any and all
assistance would be appreciated.
 
J

John Vinson

Without delving into other problems, my immediate objective is to get the
CustomerID and PetID autonumbers--from the Clientinfo and Petinfo forms,
respectively--to actually be seen in the text boxes of the main form (i.e.,
in txtCustID and txtPetID).

This seems to be using subforms backwards of the usual method. You're
choosing a CustomerID or PetID *in the subform* and pushing it into
the mainform - ordinarily, it would be done the other way around!
You'ld pick a custoemer on the mainform (perhaps using an unbound
combo box to navigate to an existing customer record), and have the
tables related to that customer (such as the pet information) appear
in the subform, using the mainform's CustomerID as the master link
field and the subform's CustomerID *field* as the child.

Could you explain what are the Recordsources of the main and subforms?
And even more so, the logic of your approach? I'm simply not
visualizing how it could be made to work!

John W. Vinson[MVP]
 
S

Scott

Thanks for the response John. I actually have been trying this approach
based on something I read by someone in the newsgroup (I've looked and looked
for it again but can't seem to find it). I know exactly what you're saying
and guess I'll rework things to get back on track. I actually started to do
this last night but ran into yet another conceptual problem that you may be
able to address, if you can find the time.

Taking the 'standard' approach and using 'customer' in the main form, I
would link that main form to a number of other subforms. One of the other
subforms would contain additional customer information and one of them would
link to pet information. Since the pets are the focus of this project, I
would then have a fair number of subforms under the pet subform. Illustrated:

Customer
CustomerAddl. Pet
Pet History Services
Check-in Medical Acctg


I believe I can handle this structure 'but' by the time I get down to the
third tier Pet History level, I'm running out of monitor space (I'm
developing this for someone who has a 15" monitor). I guess I could move the
third tier up to the second tier and link them using code...but that sort of
gets me back to where I started. Any suggestions?

Scott
 
J

John Vinson

I believe I can handle this structure 'but' by the time I get down to the
third tier Pet History level, I'm running out of monitor space (I'm
developing this for someone who has a 15" monitor). I guess I could move the
third tier up to the second tier and link them using code...but that sort of
gets me back to where I started. Any suggestions?

Use a Tab Control. This is a nice way to conserve screen real estate.
You can put one sub-subform on each page of the tab control, and just
click the tab (or button or however you choose to set up the control)
to choose which subform to look at.

John W. Vinson[MVP]
 

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