Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Composite Key & Populating Table

16 views
Skip to first unread message

david pierce

unread,
Aug 8, 2016, 9:36:28 AM8/8/16
to
Good morning all,
I need some help on the composite key in a table on how it is populated. I have found many ways to create it, yet no way to explain how to populate it.

I have a tbl_Company and a tbl_Address. I have make a tbl_CompanyAddress which will store the ID's from tbl_Company and tblAddress with a composite key. What I don't get is how does this get populated with the ID's from these two tables that I am joining.

Is It through a form code when I save. Sorry but I just don't understand it how this will work? Please help!!!!

tbl_Company tbl_Address tbl_CompanyAddress
(K) ID (K) ID (K) Company_ID
Company Namee Address1 (K) Address_ID

and so on...

Thanks

croy

unread,
Aug 26, 2016, 12:27:22 PM8/26/16
to
A form based on tbl_CompanyAddress, with comboboxes for the
two fields would do the trick. You can set up the
comboboxes to display user-understandable data, while
entering the key fields in the table.

Did this make any sense?

--
croy

Michael J. Strickland

unread,
Jan 18, 2017, 9:57:18 PM1/18/17
to
A key is like an non-displayed field that is added to your database.

While I don't remember exactly, A "composite key" sounds like a key
composed of more than one field. It is populated by Access and
consists of one or more fields combined into a single extra field
which is not displayed in the database.

In Data Sheet design view, you can hold the Ctrl key and click on
multiple fields and then click on the "Key" icon or select in the top
menu to make them a key.

A key may be implemented by concatenating all the fields composing the
key and then "hashing" them (translating the resultant string into a
number). This number will be unique for all records that have a unique
combination of entries in the fields you have selected to be the "key"
(i.e. composing your "key").

Keys can be used to identify and/or remove duplicate records. When
copying from a full table into a new, empty table with a defined key,
all records with identical key values from the source database will
cause collisions that generate errors which you can trap and handle
with an error handler. In your VBA copy routine or error handler you
can route them into either a "Duplicates" table or a "Unique_Records"
table. If you do and un coded copy in Access (click on upper left
corner of source table to select all records, then hit Ctrl-C, then
minimize source table, then click upper left corner of destination
table, then hit Ctrl-V) then it will give you a message for the first
collision (duplicate record) and let you specify not to interrupt you
for each duplicate.

The reason I wrote my own VBA De-Dupe and Purge routines
(modules/forms) is because Access's default handling of things like
empty records, empty key fields, etc was insufficient to perform the
required filtering.


On Mon, 8 Aug 2016 06:36:20 -0700 (PDT), david pierce
<dp.davi...@gmail.com> wrote:

>and so+ on...
>
>Thanks
See you at the show trials - lol.
---------------------------------------------------
Michael J. Strickland Reston, VA
---------------------------------------------------
0 new messages