How to AUTOFILL a form's field.

A

Aiaman

I have a form that is used to enter ten (10) unique sequential numbers with a
leading alpha character. I would like to be able to have the alpha character
selected automatically and then the next (100 numbers if I suply the leading
number. Presently the form knows who the user is and I believe that I can
parse out the first initial with the "Left$ («stringexpr», «n») " function.
But how do I have the command insert the next (9) sequential numbers if I
list the leading number? I have been trying to see how Excel preforms this
function so I can copy to Access but I can't figure that out either.
I have a seperate table that can be used to insert the numbers if that is
useful.
 
K

Klatuu

There are several ways this could be done, but the best method depends on how
you are assigning the values to the controls. One way would be to establish
a variable using the number you entered as the first number, then
incrementing by 1 for a total of 10:
Lets say you have a text box named txtStartNumber

Dim intIncNbr as Integer

For intIncNbr = Me.txtStartNumber to Me.txtStartNumber + 10
Me.Controls("txtNumber" & Cstr(intIncNbr) = strFirstLetter &
Cstr(intIncNbr)
Next intIncNbr
 
Top