Auto reference number code query

Haynesey

Registered User.
Local time
Today, 22:45
Joined
Dec 19, 2001
Messages
190
Hi, I use the following code to create automatic reference numbers like DHES:1, DHES:2, DHES :mad: :3 and so on. This works until it gets to DHES:10 but it now just keeps repeating itself. Any ideas?


If Me.CapitaID.OldValue = "" Or IsNull(Me.CapitaID.OldValue) Then
Me.CapitaID = "DHES:" & _
Format(Nz(DMax("Mid([EmailID], 6)", _
"tblHD", _
"[EmailID] Like '" & "DHES:" & "*'"), 0) + 1)
End If

Thanks in advance

Lee
 
Format(val(Nz(DMax("Mid([EmailID], 6)", "tblHD", "[EmailID] Like '" & "DHES:" & "*'"), 0)) + 1)

???
ken
 

Users who are viewing this thread

Back
Top Bottom