Go Back   CodingForums.com > :: Computing & Sciences > Computer Programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-16-2004, 11:58 AM   PM User | #1
Boxhead
Regular Coder

 
Join Date: Dec 2003
Location: UK
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Boxhead is an unknown quantity at this point
Access, vb and rnd

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
__________________
Monkey

My head hurts!
Boxhead is offline   Reply With Quote
Old 02-18-2004, 06:22 PM   PM User | #2
weronpc
Regular Coder

 
Join Date: Apr 2003
Location: Canada, Ontario, Mississauga
Posts: 312
Thanks: 0
Thanked 0 Times in 0 Posts
weronpc is an unknown quantity at this point
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
weronpc is offline   Reply With Quote
Old 02-19-2004, 09:24 AM   PM User | #3
Boxhead
Regular Coder

 
Join Date: Dec 2003
Location: UK
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Boxhead is an unknown quantity at this point
Quote:
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
__________________
Monkey

My head hurts!
Boxhead is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:50 PM.


Advertisement
Log in to turn off these ads.