B
BillA
A while back I had help developing a Visual Basic procedure. I would like to
reuse this procedure and add to it and I've been unable to figure out how to
do it.
This is what I have:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim varMax As Variant
Dim DocID As String
DocID = VBA.Year(Date)
varMax = Nz(DMax("Val(Mid(emplID, 5))", _
"DPH_Staff_appended", _
"emplID Like """ & DocID & "*"""), 0) + 1
Me.[EmplID] = DocID & Format(varMax, "000")
End Sub
This produces a new employee ID number based upon the calendar year:
2008001, 2008002 etc...
I would like to add 4 additional numbers that would identify the unit the
employee data was entered from. For example the central office identifier
is: 0294, another unit is 8300 etc...
I'm looking for an employee number that would read:
20080294001, 20080294002 etc... or 20088300001, 20088300002 etc...
Another approach would be to remove the year and just use the last 7 digits
- advice on both approaches would be appreciated.
Thank you,
Bill
reuse this procedure and add to it and I've been unable to figure out how to
do it.
This is what I have:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim varMax As Variant
Dim DocID As String
DocID = VBA.Year(Date)
varMax = Nz(DMax("Val(Mid(emplID, 5))", _
"DPH_Staff_appended", _
"emplID Like """ & DocID & "*"""), 0) + 1
Me.[EmplID] = DocID & Format(varMax, "000")
End Sub
This produces a new employee ID number based upon the calendar year:
2008001, 2008002 etc...
I would like to add 4 additional numbers that would identify the unit the
employee data was entered from. For example the central office identifier
is: 0294, another unit is 8300 etc...
I'm looking for an employee number that would read:
20080294001, 20080294002 etc... or 20088300001, 20088300002 etc...
Another approach would be to remove the year and just use the last 7 digits
- advice on both approaches would be appreciated.
Thank you,
Bill