473,508 Members | 2,489 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

No Unique Field to Identify Records

10 New Member
I am working with Access 2000 in Windows XP.

I am putting together a table describing a pricing structure for product groups. A single product group, however, can have different prices (per lb) depending on what plant they are from. Despite the somewhat nonsensical nature of this pricing structure, it is what I must work with.

So basically the situation is that I am trying to put together a table whose records' uniqueness is identified by the combination of the fields plant and product group. Is there a good way to do this, other than just putting it in like that? The thing that bothers me is that there is no way I see to put a primary key into this table, because there is no field that is completely unique. This table will be used in many calculations on down the road in the queries in my database, and it is important that I have it designed well. I am worried that I am already seeing the consequences of this bad design in a query that uses this table and is having issues.

Any help in this matter will be greatly appeciated!
Jul 5 '07 #1
4 1437
Rabbit
12,516 Recognized Expert Moderator MVP
You can specify a multi-field primary key, I know it's a misnomer, by selecting the two fields and right-clicking and selecting primary key. Or you could use an autonumber.
Jul 5 '07 #2
puppydogbuddy
1,923 Recognized Expert Top Contributor
I am working with Access 2000 in Windows XP.

I am putting together a table describing a pricing structure for product groups. A single product group, however, can have different prices (per lb) depending on what plant they are from. Despite the somewhat nonsensical nature of this pricing structure, it is what I must work with.

So basically the situation is that I am trying to put together a table whose records' uniqueness is identified by the combination of the fields plant and product group. Is there a good way to do this, other than just putting it in like that? The thing that bothers me is that there is no way I see to put a primary key into this table, because there is no field that is completely unique. This table will be used in many calculations on down the road in the queries in my database, and it is important that I have it designed well. I am worried that I am already seeing the consequences of this bad design in a query that uses this table and is having issues.

Any help in this matter will be greatly appeciated!
Firstly, you need to be aware that the primary key does not have to be meaningful. It just has to create a unique identifier (like the autonumber data type does) for each record in the table. In fact, most designers recommend that you not base the primary key on meaningful data in the table because the structure of that data could change, making your key invalid, creating unique complications. For example social security#'s could conceivably expand from 9 to 10 digits sometime in the future. Think of all the databases that will have to be restructured if they used ssn# as the primary key.

With that in mind, your product table could look something like this:

Autonumber.......Product............Plant......... .Unit........Price
...... Key.............Group............................. ................Per Unit
000001
000002
000003

Now to query above, you can do this:
Select * From ProductTable..........this will give you all the records in the table

If you want select a product group made in plant X:
Select * From ProductTable Where ProductGroup = zzzz and Plant = X

Hope this gives you a better idea. Before proceeding, you should take some of the tutorials on Database structure and normalization by clicking the link at the top of the Access forum home page.
Jul 5 '07 #3
tweeterbot
10 New Member
Thank you both very much!
Jul 6 '07 #4
thisisntwally
19 New Member
you could also build your own (if you wanted to avoid autonumber) with =dmax("PKfield",[table])+1
Jul 6 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1759
by: Louis O'Reilly | last post by:
I created a view that joins two tables (tblOrder and tblProduct). The field ProductID is common to both. When I save the View I get the following error message: "Column names in each view must be...
1
1510
by: Alienz | last post by:
I'm sure this is easy so if you have a sec pls help me out thx. Let say I have an inventory table and at the end of the month I want to move the info in 1 field (total end of month 1) into...
2
1716
by: ET | last post by:
Hi! I'll need help on what todo with this information in table... There has to be a unique on one column (Item ID, for inventory purpose) but in many cases that ID is not known... thus, many...
2
3085
by: john | last post by:
I have a table with 5 fields. In a query I would like to make a count for every unique combination of field 2,3, and 4. I fiddled with the count and dcount option, but can't get it to work for more...
2
2216
by: Jimmy Stewart | last post by:
Ok, I'm trying to write a query that is starting to wear me down. What I'm trying to do is create a year end report that gets sent to all of my customers who meet two criteria. One they are...
10
7939
by: rousseaud | last post by:
Hello- I'm having a little trouble. I want to create a query that will return the most recent records (by date) for all unique values in a certain field in the query. I'll be pulling data from 3...
1
1584
by: Grex | last post by:
I have a table with about 20 fields. There is a name field that is populated repeatedly with the same names over and over. Let's say 1000 records, and 25 names. Each name is in there 40 times. I...
3
1670
by: fixmycom | last post by:
I am installing a portal (php-nuke), that has a url unique field in addlink, ie no two url entries can be the same ... it also will not accept a null field (well it will but once only) ... i need to...
0
1352
by: jerald m | last post by:
Hi, i'm creating Form.in form ProjectCode is one of the Field name.in database i fixed as unique key for project code.so there is no possibilities to occur duplicate values. if i enter already...
0
7231
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7133
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7504
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5643
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5059
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4724
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1568
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.