Combine fields

Vallan

Registered User.
Local time
Today, 22:33
Joined
Jan 16, 2008
Messages
46
Hello.

Maybe this has been up here before but cant find anything.

What i would like to do is this...:

I have 3 columns.

1 Date
2 Name
3 Alternative

This is a foodordering db.

I would like to put these 3 columns in to one and there have "No duplicates allowed"

Why? I dont want them to be able to order the same food twice in the same day.

Is it a good choice making it in the table or is it any other ways to do it?


Hope you understand my question.

Mattias
 
Apply a multifield index to the three fields and set it to No Duplicates.
 
Trying that but its not working.
 
I have 5 fields


Order_ID primary key
Orderdate
Emplyees
Foodalternative
Portions

I cant make a multiple index of "orderdate", "Employees", "Foodalternative" when i have the order_ID as a primary key.

My goal is to make is imposible to make an order for the same date on an employee and the same food.

If the user does that he will get a message.... "You have already made an order for todays lunch"

I hope i explained my problem well enough.


Mattias
 
I cant make a multiple index of "orderdate", "Employees", "Foodalternative" when i have the order_ID as a primary key.
Er, yes you can. The primary key has its own index. You need to create another index with your three fields.
 
you can/should be able to add the new index

although note that if you have data that has already transgressed the unique constraint, access wont let you add the new key as "unique"

to manage indexes, in table design, look at view indexes, or click the indexes icon

-------
a word of warning - first, you dont want to have columns called Name and Date - these are reserved Access words, and are likely to cause you grief later on.

Another thing, if "name" is referring to a food item eg Cheese, then you should have a lookup table so that you get a number reference to each textual food item, eg reference 104 corresponds to Cheese, and store that reference - eg foodnameID, rather than storing the actual text. You can then control what descriptions users give food items, as otherwise you would be able to (effectively) break your rules by adding "Cheese", "Che ese", " Cheese", "Chees" etc
 

Users who are viewing this thread

Back
Top Bottom