Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

Add an auto incrementing number to the end of code

$
0
0
I have this code already

Code:

'Create RecordNum using current date

'set variables to use in future operations

    Dim sMonth As String

    Dim sDay As String

    Dim sYear As String

    'trim clears all spaces and other symbols like  / in 04/16/2013

    sMonth = Trim(Str(Month(Date)))

    sDay = Trim(Str(Day(Date)))

    sYear = Trim(Str(Year(Date)))

 

    If sMonth < 10 Then

    sMonth = "0" & sMonth

    End If

 

    'assign the textbox value to a concatenation of the variables

    Me.txtRecordNumber.Value = sMonth + sDay + sYear

And it does exactly what I need it to do. But I would like to add 3 numbers to the end of the output. They need to start at 001 and increase by one each time I click the button I have this code assigned to. In addition, they need to reset to 001 everytime the date changes. Can you help me with this?

Viewing all articles
Browse latest Browse all 13329