link child/master fields--by control? by form field name? (1 Viewer)

ehdoh

Registered User.
Local time
Yesterday, 21:43
Joined
Jun 24, 2003
Messages
58
Hello,

I am working on a database with a form and subforms that reside on a tab control. I have been designing this database off and on for some time now, and so far each of the tests I have conducted with it have been successful.

The other day it occurred to me that there could be a problem with my link child/master fields. I have designated the control named "ID" to be used as the linking field (which is also set up as the field that creates a one-to-one relationship between each table that is the record source for each form and subform). ID is the name of the control in each table (since the ID will be shared in each table for an individual record, I gave it the same name in each table) and is the primary key in my main form's table.

Is the link child/master fields property supposed to be set by the name of the control or by the name of the field on the form (e.g., Text1)? Does it matter?

According to Access's help:

"You can use the name of a control (including the name of a calculated control) to set the LinkMasterFields property, but you can't use the name of a control to set the LinkChildFields property."

If this is the case, then why has my link worked thus far since I've used a control name for both the child and the master field??? I just want to be as certain as I can that I've worked any bugs out of this database before it goes live. I appreciate any help/advice you can offer on this issue.

Cheers,
E.
 

dcx693

Registered User.
Local time
Yesterday, 21:43
Joined
Apr 30, 2003
Messages
3,265
I don't know what the actual rules are, but I use a control name in my Link Master Fields and I use a field name in the Link Child Fields. If I try to use the control name for the child field, it won't work.

What is the name of your child field? And the name of the child control?
 

ehdoh

Registered User.
Local time
Yesterday, 21:43
Joined
Jun 24, 2003
Messages
58
On each subform, the child control is ID and the child field name is Text1 (because it is the first textbox created on each form).

I have seen reference on this forum to the potential for problems if you use the same name for controls and fields, and if you use the same name for fields and controls on different forms. Perhaps this is where problems might come in from using the same names??

Should I be changing any control or field names at this point? And--to get back to my original question--should I be using the field name (i.e., Text1) rather than the control name for the link child field?
 

dcx693

Registered User.
Local time
Yesterday, 21:43
Joined
Apr 30, 2003
Messages
3,265
I think you and I are using different terminology and in the process making it seem like we're breaking the Access rules.

When I refer to a form "field", I am talking about the field from the underlying table/query. When I say a "control", I am referring to a control on the form, which may or may not be bound to a "field" from the underlying table/query.

When you say:
the child control is ID
I think you are referring to the "controlsource" of the "control". In a bound "control" this is the "field" name from the underlying table/query that stores values input into the "control".

In the end, I think you are actually linking the child field using the "field" name from the underlying table/query and not the control name from the form.
 

ehdoh

Registered User.
Local time
Yesterday, 21:43
Joined
Jun 24, 2003
Messages
58
Yes, you are correct. What I have called control is the variable listed under 'controlsource' in the properties box of that bound control on the form. What I am calling field is what is listed under 'name' in the properties box. Sorry for the confusion--I am a newbie to Access (as must be obvious!).

So since I've designated ID (the controlsource) as the link child field on each subform, will there be problems with the linkage? Should I instead be linking using Text1 as the child link? If yes to both, why haven't I seen any problems thus far when testing this form???

Cheers,
E.
 

dcx693

Registered User.
Local time
Yesterday, 21:43
Joined
Apr 30, 2003
Messages
3,265
No, I think it's OK. You're using ID, which is the name of the field from the table that feeds the form that is the controlsource for the Text1 field.
 

ehdoh

Registered User.
Local time
Yesterday, 21:43
Joined
Jun 24, 2003
Messages
58
Okay--very good.

Thank you!
 

Users who are viewing this thread

Top Bottom