By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,377 Members | 1,655 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,377 IT Pros & Developers. It's quick & easy.

Form-subform links - am I breaking the rules?

P: n/a
What are the rules regarding the linking fields between a form and
subform? Does the field on the main form *have* to be based on a
primary key?

Most examples seem to quote the use of a primary key on the main form,
but I've seen one or two places where it's implied that this doesn't
have to be the case - references in the help file to 'normally' using
a primary key, etc.

For various historical reasons I find myself having to associate a
subform to its parent using a field that isn't unique in the table on
which the main form is based. However, due to the way the main form
works, that data *will* be unique within the master form's recordset
at all times.

It appears to work in practice...

Can anyone confirm that this is a legitimate approach to take, given
that I can't use a primary key.

Thanks,

Mike
Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi Mike,

I'm not sure that it *has* to be the PK either. I believe that in most cases
that it *should* be, and that perhaps you may want to look at your table
structure to see if you might be going around it the wrong way. If data from
one table relates to data in another, there should be a way to join them. It
may require a join table to complete a many-to-many relationship for
example.

I do know that I've had a couple of occasions where I want to "auto-fill"
more than one field in my subform. I had figured out that the
LinkMaster/LinkChild automatically did this for one field, so I thought
"what the heck" ... and tried using a 2-field join. You can "pair" them by
simply adding a semi-colon between them, but the quantity and order of the
fields must remain the same. Both fields in the subform do get auto-filled.
--
HTH,
Don
=============================
Use My*****@Telus.Net for e-mail
Disclaimer:
Professional PartsPerson
Amateur Database Programmer {:o)

I'm an Access97 user, so all posted code
samples are also Access97- based
unless otherwise noted.

Do Until SinksIn = True
File/Save, <slam fingers in desk drawer>
Loop

================================

"Mike Heden" <mh****@bigfoot.com> wrote in message
news:53*************************@posting.google.co m...
What are the rules regarding the linking fields between a form and
subform? Does the field on the main form *have* to be based on a
primary key?

Most examples seem to quote the use of a primary key on the main form,
but I've seen one or two places where it's implied that this doesn't
have to be the case - references in the help file to 'normally' using
a primary key, etc.

For various historical reasons I find myself having to associate a
subform to its parent using a field that isn't unique in the table on
which the main form is based. However, due to the way the main form
works, that data *will* be unique within the master form's recordset
at all times.

It appears to work in practice...

Can anyone confirm that this is a legitimate approach to take, given
that I can't use a primary key.

Thanks,

Mike

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.