B
Benkong2
I have the need for each record to have a sequential ID number. For
example I nee the characters ECYY01 "YY would be the last 2 digits of
the current year. So it would be EC0401 next record would be EC0402 etc.
I want this to happen to each new record when it is added to the table.
My pseudo is this
take a record in a separate table tblseednumber
When the entry form loads populate the uniqueID field with a number that
is like EC0401 and gets incremented by one each time a new record is
added. This could then be in the table that holds the other information.
Any suggestions, examples and code to help would be greatly appreciated.
Thanks,
Here is some code that I am trying to work out.
Dim strFirstTag As String, strAlphaBit As String, strTemp As String
Dim iCounter As Integer, iNoTires As Integer, lNumericBit As Long
lNumericBit = (Right(strFirstTag, 4))'This gets the YYXX number part of
the record
strAlphaBit = Left(strFirstTag, 2) 'This takes the EC part
of the string
For iCounter = 0 To iNoTires - 1
strTemp = Trim(Str(lNumericBit + iCounter))
Do While Len(strTemp) < 4
strTemp = "0" & strTemp 'Correct xx00 to xx000 + 1
etc
Loop
strTagArray(iCounter) = strAlphaBit & strTemp 'Put the
val into the array
strMsg = strMsg & strAlphaBit & strTemp & vbTab & vbCrLf
Next iCounter
example I nee the characters ECYY01 "YY would be the last 2 digits of
the current year. So it would be EC0401 next record would be EC0402 etc.
I want this to happen to each new record when it is added to the table.
My pseudo is this
take a record in a separate table tblseednumber
When the entry form loads populate the uniqueID field with a number that
is like EC0401 and gets incremented by one each time a new record is
added. This could then be in the table that holds the other information.
Any suggestions, examples and code to help would be greatly appreciated.
Thanks,
Here is some code that I am trying to work out.
Dim strFirstTag As String, strAlphaBit As String, strTemp As String
Dim iCounter As Integer, iNoTires As Integer, lNumericBit As Long
lNumericBit = (Right(strFirstTag, 4))'This gets the YYXX number part of
the record
strAlphaBit = Left(strFirstTag, 2) 'This takes the EC part
of the string
For iCounter = 0 To iNoTires - 1
strTemp = Trim(Str(lNumericBit + iCounter))
Do While Len(strTemp) < 4
strTemp = "0" & strTemp 'Correct xx00 to xx000 + 1
etc
Loop
strTagArray(iCounter) = strAlphaBit & strTemp 'Put the
val into the array
strMsg = strMsg & strAlphaBit & strTemp & vbTab & vbCrLf
Next iCounter