Only positive values in random auto-numbers. (1 Viewer)

insixt

New member
Local time
Today, 15:27
Joined
Sep 10, 2009
Messages
8
Hello all
.
I have a table where I would like the primary key to be automatically generated by Microsoft Access. At present I have the field set to Auto Number(Random) and Long Integer. Unfortunately this gives me both positive and negative values. How can I get Access to just return positive numbers (I do not wish for the number to be incremented - I need random.)


Thanks for reading and I hope you can help!
 

boblarson

Smeghead
Local time
Today, 15:27
Joined
Jan 12, 2001
Messages
32,059
You cannot use Autonumber for this and I question why you feel you need a primary key that has random numbers but no negatives. A primary key should only be something the SYSTEM is worried about, not you or your users. You can generate anything you want to use outside of that, but the PK is really for the use of the system to maintain relationships and ensure relational integrity.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 17:27
Joined
Feb 28, 2001
Messages
27,138
When you introduce ANY CONSTRAINT AT ALL into your PK, autonumber leaves the table. You are imposing (some kind of) meaning on the autonumber, which the standard Access Autonumber doesn't support.

I concur with Bob.
 

Users who are viewing this thread

Top Bottom