Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 10th, 2007, 12:48 PM
Authorized User
 
Join Date: Feb 2007
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default Create random statements

How would you use the random function to generate a random statement once a button is pushed?

 
Old August 13th, 2007, 12:06 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

When you say "random statement," what exactly does that mean? Randomize will generate random numbers between preset upper and lower limits like this:

Randomize
iMyNum = Int((300 * Rnd) + 425)

This will generate a random number between 300 and 425, for example.

Does this help? There is plenty of material on how this works in VBScript reference works on Microsoft.Com. There is even scripting center there.



mmcdonal
 
Old October 2nd, 2007, 03:09 PM
pjm pjm is offline
Authorized User
 
Join Date: Jul 2006
Posts: 70
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Actually iMyNum will contain a random integer from 425 to 724.

-Phil-
 
Old October 3rd, 2007, 07:08 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

That is correct. I was typing too fast. I use this code to generate random numbers in an encryption scheme, and need a high range from 4 to 700.




mmcdonal





Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem when i create a random code verification srkarthik_82 C# 2005 1 November 26th, 2007 05:17 AM
How to create a random alphabet? gefferye C# 1 October 29th, 2005 10:33 PM
How to create insert statements? mooreeasyvibe Excel VBA 0 August 31st, 2005 06:00 AM
How to generate CREATE TABLE statements for tables method Access VBA 0 April 3rd, 2005 01:17 PM
Random Numbers not so random... katsarosj ASP.NET 1.0 and 1.1 Basics 5 November 20th, 2003 12:55 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.