Set primary key to random number for version 2010

I want to set primary key for random numbers.  I could set the 'New Values' field property on Access 2003 but I don't see it on 2010 version.  Is there another way to do this?

Thanks
zpotokAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

lee555J5Commented:
In table design mode, highlight the primary key field. In the bottom properties section, set the New Values property to Random.

Lee
0
Aaron TomoskySD-WAN SimplifiedCommented:
I don't suggest having random numbers or guids as PKs. Lookup uuid as Pk or guid as Pk and you will find discussions on how it messes up indexing, slows down queries, etc...
Can I ask why you need a random Pk and not a autoincrement Pk?
0
zpotokAuthor Commented:
Unless I'm looking at this wrong - There isn't a property called New Field as I stated in my question.

I see your point on indexing and all.  I just didn't want to start off with 1, 2, etc.  does auto increment have to start as 1,2 etc?  
0
The 7 Worst Nightmares of a Sysadmin

Fear not! To defend your business’ IT systems we’re going to shine a light on the seven most sinister terrors that haunt sysadmins. That way you can be sure there’s nothing in your stack waiting to go bump in the night.

lee555J5Commented:
Have you set your DataType to AutoNumber and your Field Size to Long Integer?

Lee
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
If your database is designed correctly, then the value of your AutoNumber field should have no impact on the data, so it shouldn't matter whether Jet/ACE assigns a value of 1 or 146,244 to a record. The AN field should ONLY be used as a surrogate index for a record - you should still set a Unique index to ensure data uniqueness (the AN field should have NO bearing on that). If your AN field has some sort of "value" to the record, then I'd suggest you might be using the AN field incorrectly.

Note you can "seed" the AN field like this:

Currentdb.Execute "INSERT INTO YourTable(YourANField) VALUES(3000)"

Compact the database, and YourTable.YourANField would begin the count at 3001.


0
Aaron TomoskySD-WAN SimplifiedCommented:
With mssql an mysql you can change the value of thenext auto increment, I don't know if you cando this in access but it should be somewhere. I like to reset mine to 0 when I'm testing imports.
0
zpotokAuthor Commented:
Thanks...good discussion
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.