K
Kyla Dockery
I put in everything exactly as you had it (except of course for Entering my
table name) and nothing happened. Here is what I did:
Private Sub lstDocumentType_AfterUpdate()
Dim strNext As String
Dim iNext As Integer
If IsNull(Me!txtDocumentNumber) Then ' don't stomp on existing values
strNext = Nz(DMax("[DocumentNumber]", "[Engineering_Tooling_Table]", _
"[DocumentType] = '" & Me!lstDocumentType & "'"), "X00000")
iNext = Val(Mid(strNext, 2)) ' extract the number as an integer
If iNext = 99999 Then
MsgBox "No Additional Numbers Available!"
Exit Sub
Else
Me!txtDocumentNumber = Left(strNext, 1) & _
Format(iNext + 1, "00000")
End If
Else
MsgBox "This document already has a document number assigned!" _
& vbCrLf & "Erase the DocumentNumber before changing Type.", _
vbOKOnly
End If
End Sub
table name) and nothing happened. Here is what I did:
Private Sub lstDocumentType_AfterUpdate()
Dim strNext As String
Dim iNext As Integer
If IsNull(Me!txtDocumentNumber) Then ' don't stomp on existing values
strNext = Nz(DMax("[DocumentNumber]", "[Engineering_Tooling_Table]", _
"[DocumentType] = '" & Me!lstDocumentType & "'"), "X00000")
iNext = Val(Mid(strNext, 2)) ' extract the number as an integer
If iNext = 99999 Then
MsgBox "No Additional Numbers Available!"
Exit Sub
Else
Me!txtDocumentNumber = Left(strNext, 1) & _
Format(iNext + 1, "00000")
End If
Else
MsgBox "This document already has a document number assigned!" _
& vbCrLf & "Erase the DocumentNumber before changing Type.", _
vbOKOnly
End If
End Sub