Re: Access automatically adding unwanted fields to master/child links

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



bs_aggie wrote:

I have a form with that a tab control that dynamically loads several
subforms when a tab is changed.

http://www.databasejournal.com/features/msaccess/article.php/3599781

The tab control has unbound subform in which I have specified the
master and child links in the properties for that control. The fields
used for the master and child links have the same name on all
underlying tables.

When a new tab is selected, the tab change event code sets the
SourceObject property of the unbound subform object to the desired
subform depending on which tab is chosen.

The problem I'm having is that when the SourceObject property is set,
Access is automatically adding an additional relationship to the
master/child link in addition the one I specified. The only
relationship defined between the two tables is for the field that I
manually specified. There is no relationship defined between the
fields that Access is adding (or at least one that I can find). I
can't figure out where access is getting this relationship from or how
to keep it from doing it.


It's probably doing that because the names of the fields are
the same or some other stupid reason.

Just reset the Link Master/Child properties when you set the
SourceObject property. You may have to set them to "" first
and it may make a difference which one you set first.

It probably won't matter now, but you might want to clear
the list in Tools - Options - Tables/Queries - Auto Index

--
Marsh
MVP [MS Access]
.


Quantcast