Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Random #'s

Status
Not open for further replies.

Jengo

Programmer
Apr 17, 2000
100
US
How do I do a # that is like an autonumber that takes the date like 000418 and adds a number starting at one and progressively rising through access.  Example, 0004181, 0004182, 0004183, 0004184, 0004191,0004192, 0004201, and so on.....
 
Looks like you are using your numbers to tell a story.<br>Which is a lot of work rather than let the computer generate and Autonumber number like Invoice Number. Which is just in sequence and if you need the date look in the date field.<br>Your numering suytem comes from a time when you had not computers.<br>Then when you have to add a record you MUST use this code instead of Just an autonumber which will seqeunce by itself.<br>And you have to keep track of the last number that goes up one at a time.<br>I hope you are good at VBA<br><br>Here's a start<br>-----------------------------<br>Public Function RandomNumber(Sequence)<br>&nbsp;&nbsp;&nbsp;&nbsp;RandomNumber = &quot;000&quot; & Trim(Month(Now)) & Trim(Day(Now)) & Trim(Sequence)<br>End Function<br><br><br><br><br><br> <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top