Aug 18, 2009 #1 Mr2006 Technical User Joined Jun 21, 2006 Messages 80 Location 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 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
Aug 18, 2009 #2 dhookom Programmer Joined Jun 24, 2003 Messages 22,561 Location US 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 Upvote 0 Downvote
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
Aug 18, 2009 #3 dhookom Programmer Joined Jun 24, 2003 Messages 22,561 Location US 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 Upvote 0 Downvote
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
Aug 18, 2009 Thread starter #4 Mr2006 Technical User Joined Jun 21, 2006 Messages 80 Location US dhookom, will this be for a form after update event... Upvote 0 Downvote
Aug 18, 2009 #5 dhookom Programmer Joined Jun 24, 2003 Messages 22,561 Location US Probably work better in the Before Update. Test it and report back. Duane Hook'D on Access MS Access MVP Upvote 0 Downvote
Probably work better in the Before Update. Test it and report back. Duane Hook'D on Access MS Access MVP