?
Solved

access.mdb unique field

Posted on 2007-03-26
5
Medium Priority
?
407 Views
Last Modified: 2012-08-14
Hello
I have an access.mdb table with three fields
ID Key autonum
supplierID number
StockID          number      
I want to combine supplierID and StockID in one and make it unique
Is this possible in access.mdb?
Regards
John
0
Comment
Question by:johnhardy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 26

Expert Comment

by:jerryb30
ID: 18793259
You could create a composite index of the two fields, making them unique.  This would prevent the combo of the two from being added to the db.
0
 

Author Comment

by:johnhardy
ID: 18793370
Thanks
Can you please say how I create a composite field in access please?
0
 
LVL 13

Accepted Solution

by:
adraughn earned 1200 total points
ID: 18793410
In table design, select both fields and then set primary key by selecting the key from the toolbat. This will prevent duplicates of records where both id's are identical.

If you need to show the combination of the fields in a query/form/report, just use this as an expression:

in access:
Expr1: [SupplierID] & [StockID]

in SQL:
[SupplierID] + [StockID] AS Expr1

-a
0
 
LVL 26

Assisted Solution

by:jerryb30
jerryb30 earned 800 total points
ID: 18793538
To create composite index, open table in design view.
Select View-Indexes, and give index a name. In the fields column, out in the two vields, i below the other, that you want to be unique.
Then, click in index name column. In index properties options, set Unique = yes.
Save your table.
Note, if you have two records with same supplierID and stockID, you will have to get rid of dupes before doing this process.
0
 

Author Comment

by:johnhardy
ID: 18793739
Many thanks for the answers.

Very helpful
Regards
John
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question