Confiration Number with 3 parts?

computingguru

New member
Local time
Today, 12:41
Joined
Aug 12, 2006
Messages
3
Hello, thanks for reading!

I want to generate a confirmation number that is based in three parts.

1. the Date issued
2. What is checked or not checked in a series of 7-10 check boxes
3. a random 4 digit number

Out put sample would be something like this: 060801-1100101-9846

issue Date-1 being checked, 2 being unchecked-Random number.

This will be stored as a record in a table probably along with the fields of date issued, the check boxes.

Do have any thought or suggestions on the code for this or any part of this.

Thanks in advance for your help. :D
 
You'll need to write a function in VBA.
Have a look at the Randomize statement to generate randomized numbers.

Or search the forum.

RV
 
Got all but the check boxes?

Thanks RV...

I figured out all of the code except the check boxes. Still looking for that.

I did this:

Public Function con() As String


Dim confirmationNum As String
Dim conYr As String
Dim conMn As String
Dim condate As String
Dim condate2 As String


Dim conFinal As String

conYr = Year(Now)
conMn = Month(Now)

confirmationNum = Int((99999 - 10000 + 1) * Rnd() + 0)
condate2 = conYr + "-" + conMn + "-" + confirmationNum

con = condate2



End Function
 
cg,

Interesting requirement.

Generally when you "construct" keys, you should store each component individually.
In this case, I'm not so sure.

Also, don't know about the checkboxes. What if their values change!?

Anyway, you can use the BeforeInsert event of your form and put something like:

Code:
strThePK = Format(Date, "yymmdd") & _
           "-" & _
           IIf(chkBox1, "1", "0") & _
           IIf(chkBox2, "1", "0") & _
           IIf(chkBox3, "1", "0") & _
           IIf(chkBox4, "1", "0") & _
           IIf(chkBox5, "1", "0") & _
           IIf(chkBox6, "1", "0") & _
           IIf(chkBox7, "1", "0") & _
           "-" & _
           Format(Int(Rnd() * 10000.0), "0000")

hth,
Wayne
 
Awesome

thanks Wayne,

That is what I needed. I really appreciate your help. As far as the values of the check boxes changing, I will be tracking the values of checkboxes in fields. However, they shouldn't change. I wouldn't normally want a long confirmation number like this but it is what the customer wants.

cg
 
Last edited:

Users who are viewing this thread

Back
Top Bottom