Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto Number

Status
Not open for further replies.

Mr2006

Technical User
Jun 21, 2006
80
US
I would like to create custom autonumber that will contain the following:

firstletter from firstname
first letter from lastname
dateof birth.

John Smith 04/05/2008
JS04052008

How can I go about doing this?

Thanks
 
I would create a small function or sub in the form module like:
Code:
Function UpdateCustAuto() as boolean
    Me.txtCustAuto = Left(Me.txtFirstName & " ",1) & _
        Left(Me.txtLastName & " ",1) & _
        IIf(IsNull(Me.txtDOB),"00/00/0000",Format(Me.txtDOB,"mmddyyyy")
End Function
You can then call this function from the after update event of the other controls.


Duane
Hook'D on Access
MS Access MVP
 
oops,
Code:
Function UpdateCustAuto() as boolean
    Me.txtCustAuto = Left(Me.txtFirstName & " ",1) & _
        Left(Me.txtLastName & " ",1) & _
        IIf(IsNull(Me.txtDOB),"00000000",Format(Me.txtDOB,"mmddyyyy")
End Function

Duane
Hook'D on Access
MS Access MVP
 
dhookom,

will this be for a form after update event...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top