File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes General Computing and the fly likes Rand a floating number in MS Access Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Engineering » General Computing
Bookmark "Rand a floating number in MS Access" Watch "Rand a floating number in MS Access" New topic

Rand a floating number in MS Access

Elahe Shafie
Ranch Hand

Joined: Dec 12, 2001
Posts: 291
Hi Friends,
Does any body know how can I Rand a number in MS Access?
Elahe :roll:
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

You can make an AutoNumber field produce a random number (in design view, select the row, and make the type 'AutoNumber' and at the bottom, select 'New Values = Random'

If it *must* be a float, or if you're wanting a number at some other time than row insertion, you could use VBA to produce a random number. It's been too long since I worked in VBA, so I can't help you with that code, but I know it's possible. Add a new module, and hope that your Access install has the VBA help files installed, if you're not sure of VB yourself.
Don't get me started about those stupid light bulbs.
subject: Rand a floating number in MS Access
It's not a secret anymore!