...

View Full Version : Access, vb and rnd



Boxhead
02-16-2004, 12:58 PM
I am trying to get a random number as my key, but always a positive and always 6 digits (and obveously no duplicates).

I have read on forums that this can be done with visual basic - I have the script and I can open the vb editor in access - but thats me stuck!!

WHERE do i write the script in vb editor, and HOW do i then use this script in my access table?

Could someone hold my hand (virtually that is, no funny emails please!) and walk me through.

Cheers

Monkey

weronpc
02-18-2004, 07:22 PM
Are you trying to find out how to generate a random number or where to endit the code?

to generate a randome number from 0 to 6
Int(Rnd * 7)
reason I multiply by 7 because the number always lower than 7, what number is lower than 7? it's 0 to 6

to edit code in access using Visual Basic
Open Access
Click Tools on the menu bar,
then select Macro,
then click Visual Basic Editor.

Mike

Boxhead
02-19-2004, 10:24 AM
I can open the vb editor
WHERE do i write the script in vb editor, and HOW do i then use this script in my access table?


I can generate a random number (as in, write the script) but dont know WHERE to put it IN vbeditor (never used it before) and how to use that code as my random number key in my table.

cheers



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum