Simple Concatonated Primary Key Question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to run a query with a primary key composed of two fields. The
first is Part Number the second is Customer. The Part Number field came from
the "Parts Master" table. The Customer field came from the "Sales History"
table. I was able to successfully make a primary key by putting PN&Cust:
[PartNumber].[Partsmaster]&[Customer].[Sales History]. But once I made a new
query and linked the new combined/concatonated field (from the new make-table
I had just made) to the same "Parts Master's Part Number field and "Sales
History"'s Customer field, the screen asked me to "Define Paramaters for
[PartNumber].[Partsmaster]. I clicked o.k. three times without entering
anything. It then asked me to define parameters for [Customer].[Sales
History]. I did the same thing without entering anything. On the second
query, I put criteria under "sales date"(a field in the make table field that
I just created) to give a certain date range(2004). The query ran but said
"you are about to post 0 records".


Any help in the right direction would be greatly appreciated..
 
I'm trying to run a query with a primary key composed of two fields. The
first is Part Number the second is Customer. The Part Number field came from
the "Parts Master" table. The Customer field came from the "Sales History"
table. I was able to successfully make a primary key by putting PN&Cust:
[PartNumber].[Partsmaster]&[Customer].[Sales History].

That is neither necessary nor appropriate. A Primary Key can consist
of up to TEN fields; it is not a good idea to store information
redundantly by copying it to another field, and it's even worse to
violate the atomicity principle by storing two pieces of information
in a single field!

Secondly, a Table must have a Primary Key; however, a Query does not
and cannot have a Primary Key. Are you assuming that you must have a
Primary Key in order to sort the data, or what? It's not necessary;
simply put Ascending on the sort row of the query.

Perhaps you could post the SQL view of this query and describe what
you're trying to accomplish. I don't think it's as hard as you seem to
be making it!

John W. Vinson[MVP]
 
Back
Top