Link Child Link Master Not Working

M

Mark C

I have a unbound form with a tab control with four tabs in an Access 97
database. On each tab I have a sub form each form on the sub forms is bound
to its own table. Each table has a field that can link them all together. I
have put an invisible unbound control on the master form that gets populated
on open. I set the link child and link master of each sub form to the
unbound control on the master form. When the form opens all the subforms
show are the first record in their underlying tables and not what the field
on the master should be linking.

On open of the master I have been successful in setting the record source of
each sub form to show what I want but I would like the link child and link
master to do it's job. Any help would be much appreciated.



Regards,
Mark
 
A

Allen Browne

Hi Mark. What you are aiming to do makes perfect sense, so it will be
worthwhile taking the time to trace what's going on.

Suggestions to get you started:

1. Timing?
When are you setting the value of these unbound controls? The Open event of
the form would be as early as possible, so try that. Alternatively, you may
be able to just set their Control Source to something like:
=1

2. Data type?
If the values are numeric, try setting the Format property of these unbound
controls to:
General Number
or try Short Date if they are dates. This will help Access understand the
intended data type.

3. Bad names?
Make sure that none of the names used in the
LinkMasterFields/LinkChildFields could be misunderstood as a built-in
property. Bad names include Name (the name of the form), Date (VBA
constant), Section (a property of forms), etc.

4. Dynamically changed?
Under certain conditions, Access will reassign (or even deassign) the
LinkMasterFields and LinkChildFields, so check this has not happened. While
the form is open and displaying the problem, open the Immediate Window
(Ctrl+G) and check the values by entering something like this:
? Forms!MyForm![MySubformControlName].LinkMasterFields
Does it contain the expected name?
 
M

Malcolm Cook

Mark,

A close reading of your sentence -
I set the link child and link master of each sub form to the
unbound control on the master form.

makes me wonder...

It sounds like you are setting the 'Link Child Fields' to the same value as
the 'Link Master Fields', both being set to the name of the invisible
unbound control. If so, this is your mistake. The 'Link Child Fields' must
be set to the name of a control or access field on the form displayed in
each subform.

Can this possibly be your problem????

BTW, it is possible to have a single subform control whose 'Source Object'
gets dynamically changed to the name of the form you want to display (based
on whatever criteria, be it a tabl controls setting, radio buttons, passing
of time, what have you). I think (not sure) that this saves in some
overhead as only the form that the user cares to see has its records loaded.

Regards,
 
M

Mark C

Thank you Allen and Malcolm,

My problem was that the control on the main form was not named the same as
the controls on the sub forms. I was putting the Link Child and Link Master
fields with the same name. Once I changed accordingly all worked fine.
That's what I get for working 12 hours a day. Thank you both for the advice.

Regards,
Mark
 

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