Reputation: 37
please have at look on my issue.
I try to assign a autonumber with increment plus 1 for each new record in [No] as integer. I use following code, but it doesn`t works correctly, and records stops calculated.
Private Sub Ser_AfterUpdate()
If Ser = "O" Then
Dim MyYear, varLast
MyYear = Year(Date)
Yr = Right(MyYear, 2)
varLast = DLast("No", "NotamT")
No = varLast + 1
Types.Requery
Else
MsgBox "WRONG NOTAM SERIES"
End If
End Sub
Upvotes: 1
Views: 51
Reputation: 55841
It is not very clear, what you try to do, but it could be something like this:
Private Sub Ser_AfterUpdate()
If Ser = "O" Then
Me!Yr.Value = Year(Date) Mod 100
Me!No.Value = Nz(DMax("No", "NotamT")) + 1
Me!Types.Requery
Else
MsgBox "WRONG NOTAM SERIES"
End If
End Sub
Upvotes: 1