No, I am concatenating literal value of "PK" and the results of a call to Rnd
(random number generator) formatted so that the number is always 8 characters
and populating the File_ID control with the concatenated values. So, if
Me.Division starts with "PK" and the random number generator returs 53421,
the result would be "PK00053421"
Barb said:
I think you're trying to concatinate [Division] with numbers entered in text
box on the form?
something like that? [Division]&[textbox1]
Barb
:
Yes, thanks. To do this, it needs to be in the After Update event of Division:
Dim lngBigNum as Long
If Left(Me.Division,2) = "PK" Then
Randomize
lngBigNum = Int((99999999 *Rnd) + 1)
Me.File_ID = "PK" & Format(lngBigNum, "00000000")
End If
The code checks to see if Division starts with PK. If it does, it creates a
random number. The NUmber is them formatted so it is always 8 characters
long. Then the literal PK and the formated number are concatenated and used
to populate the File_ID text box.
:
I am not understanding your question? Are you talking about the numbers that
will have to go where the *'s are located? If so, for example, the numbers
can be PK12345678. Bascially, any numbers can go behind the PK.
:
I can help if you can tell me how to know what number to use.
:
I know that the *'s have to be filled in with number. Can you help assist me
in writing this code?
:
How do you know what numbers to use?
:
*I am trying to write some code stating that if Me.Division starts with "PK"
then Me.File_ID needs to start with "PK*******"? The *'s have to be filled in
with numbers. How do I write this code in VB?
Thanks,
Q.Hills