Solved

Auto Number Generation within a range

Posted on 2002-05-10
4
273 Views
Last Modified: 2008-03-10
In a particular form, I want to automatically generate receipt numbers within certain range. The users should be prompted to enter the lower limit and upper limit and the automatic generation of  numbers should be within these limits. Please give me some coding guidelines.
0
Comment
Question by:r_venkatadhri
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 3

Expert Comment

by:jbil
ID: 7001685
Option Explicit
Private Sub Form_Load()
Randomize Timer
End Sub

Private Sub Command1_Click()

Dim HighNum As Integer
Dim LowNum As Integer
HighNum = Text1
LowNum = Text2
HighNum = HighNum - LowNum
Text3 = Int(Rnd * HighNum) + LowNum

End Sub


0
 
LVL 22

Expert Comment

by:rspahitz
ID: 7001940
Are you looking for a sequential list of the numbers in the range, a random list of numbers, or a single number to be returned?
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7002480
dim i as long
for i= LNum to HNum
    debug.print i
next i
0
 
LVL 16

Accepted Solution

by:
Richie_Simonetti earned 100 total points
ID: 7002483
Or
dim LNum as long,Hnum as long
LNum=inputbox$("Please enter lower number")
HNum=inputbox$("Please enter High number")
if (lnum<>"" and hnum <>"" and lnum<hnum) then
   dim i as long
   for i= LNum to HNum
      debug.print i
   next i
end if

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question