943,640 Members | Top Members by Rank

Ad:
Jun 21st, 2005
0

Help

Expand Post »
AM trying to use a string "0000" to generate an auto number. i.e 0000 +1 to increment to 0001. how do i achieve this.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mwaora is offline Offline
5 posts
since Jun 2005
Jun 23rd, 2005
0

Re: Help

Quote originally posted by mwaora ...
AM trying to use a string "0000" to generate an auto number. i.e 0000 +1 to increment to 0001. how do i achieve this.

**************************************************

hope this one helps...

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. dim x as integer 'declare first variable
  2.  
  3. x = 0 'set the value of your variable
  4.  
  5. for x = 1 to 2000
  6.  
  7. s = len(str(x)) 'here we will check the length of x
  8.  
  9. select case s
  10.  
  11. case 1
  12. x2 = "000" & str(x)
  13. case 2
  14. x2 = "00" & str(x)
  15. case 3
  16. x2 = "0" & str(x)
  17. case 4
  18. x2 = str(x)
  19.  
  20. end select
  21.  
  22. next x
  23.  
  24. msgbox str(x2)
Reputation Points: 11
Solved Threads: 0
Light Poster
vhinehds is offline Offline
29 posts
since May 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Creating an array/collection that holds variables
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: generating report footer





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC