primary key for field its typed is a Date/Time

Nader

Registered User.
Local time
Yesterday, 22:34
Joined
Oct 9, 2008
Messages
10
I created a Table including tow Fields A,B
The teyped of A is Text.
The typed of B is Date/Time.I set B a primary key
The question is:
When I set to first row in B this Date 01/01/2009
and I tried to set the same Date to second row;it didn't acccpet this
Is this possible to set the same date to many row. with keep the B a primary key?
 
a primary key HAS to be unique

i would be inclined to add an autonumber field, and make that the primary key

then add another index to hold your date which can then be set as non-unique

in order to relate the table to other tables you will probably need a unique index, anyway.
 
A primary key can't contain duplicate values - each value is supposed to identify a specific record - if it identifies more than one, it can't function as a primary key.

Could you describe what you're trying to achieve, in a little more detail?
 
so How can I make the row arrangement as the Date/Time
it's mean, I want to make the Fields in Table like this:

A------------ B
zzz ------- 01/01/2009
ddd ------- 01/01/2009
fff ------- 02/01/2009
ggg ------- 03/01/2009
ttt ------- 03/01/2009
 
Are you worried about the sort order? A table does not have an order as such (even though it might appear so). You sort your data using queries. What are you really wanting to do (in the bigger scheme of things).

Having said that you still need to have a primary key so Gemma's suggestion of an autonumber may be appropriate for you.

Chris
 
Nader,

Best solution is to add an AutoNumber as suggested.

You could also use Now() and in *most* cases you'd get
a unique date/time.

You could also make the PK be both fields A and B.

I'd stay with the AutoNumber suggested earlier.

Wayne
 
Nader,

Best solution is to add an AutoNumber as suggested.

You could also use Now() and in *most* cases you'd get
a unique date/time.

You could also make the PK be both fields A and B.

I'd stay with the AutoNumber suggested earlier.

Wayne
Can you help more, I can't understand.
 

Users who are viewing this thread

Back
Top Bottom