Access automatically adding unwanted fields to master/child links

B

bs_aggie

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.

I've deleted all defined relationships and it still does it. I've
recreated the form from scratch and it still does it.

I've been using this dynamic subform loading in another database and
haven't had any problems.

Any ideas?

Thanks
 
T

tina

if your database is A2000 or newer, did you turn OFF the Name Autocorrect
feature? if not, suggest you do so from Tools | Options | General tab. that
misfeature does have a way of hanging around though, so suggest you go a
step further and:

1. create a new blank database.
2. immediately turn OFF Name Autocorrect.
3. compact the database.
4. import all the objects from your database into the new one.
5. compact again.

hth
 
B

bs_aggie

if your database is A2000 or newer, did you turn OFF the Name Autocorrect
feature? if not, suggest you do so from Tools | Options | General tab. that
misfeature does have a way of hanging around though, so suggest you go a
step further and:

1. create a new blank database.
2. immediately turn OFF Name Autocorrect.
3. compact the database.
4. import all the objects from your database into the new one.
5. compact again.

hth












- Show quoted text -

I'm using AC2003 and the name AutoCorrect feature was already turned
off.
 
M

Marshall Barton

bs_aggie said:
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
 
A

Albert D. Kallal

yes, I seen this before. and, this even occurs with track-name auto turned
off...

in fact, it even occurs in the runtime and when you use a mde....

The fix:
my code often goes:

Me.sf1.Form.RecordSource = strSql
Me.sf1.LinkChildFields = ""
Me.sf1.LinkMasterFields = ""

So, right after you throw in the sql, then simple wash out the link fields
with the above.

Not pretty...but it works for me.....
 

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