Hello,
I use the following function to add a next class name into the tblClass, ClassName field.
Code:
'function returns the next Class Name for frmAddNewClass form
Public Function GetNum() As String
Dim STR As String
'no records from current year
If IsNull(DLookup("ClassName", "tblClass", _
"left(ClassName,2)='" & Right(CStr(Year(Date)), 2) & "' ")) Then
GetNum = Right(CStr(Year(Date)), 2) & "-" & "001"
Else
STR = CStr(CInt(Right(DMax("ClassName", "tblClass", _
"left(ClassName,2)='" & Right(CStr(Year(Date)), 2) & "' "), 3)) + 1)
GetNum = Right(CStr(Year(Date)), 2) & "-" & ZeroLeft(STR, 3)
End If
End Function
This will result in ClassName being 15-001, 15-002....
How do I add a specific text (CLASS) to appear before the 15-001, like CLASS 15-001, CLASS 15-002 etc.
Thank you