General Date not OK as PK?

J

Jim Shaw

BlankContext: Access 2002 SP/3 installed:

In a table I'm trying to use a compound Primary Key consisting of EmpID (a
SSN) and Posted (=now()).
Having successfully added the first record and then waiting 5 mins, I
attempt to add a second record having
the same EmpID value and a different "Now" value. The datevalues are the
same, but the timevalues are different.
Both fields are indexed w/dups ok.

The second add fails for duplicate PK. Does not Access look at the time
component of Posted?

Thanks
Jim
 
D

Dirk Goldgar

Jim Shaw said:
Context: Access 2002 SP/3 installed:

In a table I'm trying to use a compound Primary Key consisting of
EmpID (a SSN) and Posted (=now()).
Having successfully added the first record and then waiting 5 mins, I
attempt to add a second record having
the same EmpID value and a different "Now" value. The datevalues are
the same, but the timevalues are different.
Both fields are indexed w/dups ok.

The second add fails for duplicate PK. Does not Access look at the
time component of Posted?

How are you getting this Now() value into the field of the record?
 
J

Jim Shaw

Immanuel;
The data type is "date" with a format of "general date"
It is indexed w/Duplicates OK
Jim
 
B

Brendan Reynolds

I can't reproduce this. I created a table with two fields, one long integer,
one date/time. I made the default value of the date/time field =Now(), and
created a primary key on the combination of the two fields. I entered
multiple records into the table, all with the same value in the long integer
field, without any difficulty.

I think Dirk must be on the right track - it must have something to do with
how you're assigning the values via the recordset.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
J

Jim Shaw

Thanks. At least I know the problem is mine and not a "feature" of Access.
I'll look things over more closely
Thanks
Jim
 
Top