Loop

adam-red

New member
Local time
Today, 03:32
Joined
Feb 8, 2007
Messages
3
I've got a form in access with a listbox and two textboxes. When you enter a name in the first box and a number in the second (say 35), a loop generates a string and adds each entrie to the listbox. For example adam-red1, adam-red2....on to 35. The thing is I want the entries to have a zero prefix (ie 01, 02, 03). Any ideas? Here's the loop I've got at the moment.

Code:
'************ Start Loop ************
intStartNum = 1
Do
strNewID = strPrefix & intStartNum      'add number to prefix
lstNewUsers.AddItem (strNewID & ";" & strPassword & ";" & strExpDate)   'add new ID to listbox
intStartNum = intStartNum + 1           'increment loop

Loop Until intStartNum = (intNumUsers + 1)
'************ End Loop ************

Thanks in advance
Adam
 
I don't understand how to fit this into my code though? :confused: It needs to return a value.
 
strNewID = strPrefix & Format(intStartNum,"00")
 

Users who are viewing this thread

Back
Top Bottom