Web Analytics Made Easy -
StatCounter Access, vb and rnd - CodingForum

Announcement

Collapse
No announcement yet.

Access, vb and rnd

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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!

  • #2
    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

    Comment


    • #3
      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!

      Comment

      Working...
      X