G
Guest
I want to use the AfterUpdate event when a field (Me.NewANDI) has been
filled. The field can be completed manually or auto-filled by a button.
AfterUpdate gets triggered as it should when I manually fill it. But when
the button code fills it, the event does not occur. I suspect the problem
lies in the button code, so here it is:
Private Sub AddNewIDBttn_Click()
Dim intLastID As Integer
intLastID = DLookup("[LastID]", "LastIDTbl") 'Get the last generated ID.
Me.NewANDI = "DB" & Format(Str(intLastID + 1), "00000")
DoCmd.SetWarnings False 'Disable
warning.
DoCmd.RunSQL "UPDATE LastIDTbl SET LastID = LastID + 1 "
DoCmd.SetWarnings True 'Reset
warning.
End Sub
If anyone can tell me my error -- or point in another direction -- I would
appreciate it. Thanks.
filled. The field can be completed manually or auto-filled by a button.
AfterUpdate gets triggered as it should when I manually fill it. But when
the button code fills it, the event does not occur. I suspect the problem
lies in the button code, so here it is:
Private Sub AddNewIDBttn_Click()
Dim intLastID As Integer
intLastID = DLookup("[LastID]", "LastIDTbl") 'Get the last generated ID.
Me.NewANDI = "DB" & Format(Str(intLastID + 1), "00000")
DoCmd.SetWarnings False 'Disable
warning.
DoCmd.RunSQL "UPDATE LastIDTbl SET LastID = LastID + 1 "
DoCmd.SetWarnings True 'Reset
warning.
End Sub
If anyone can tell me my error -- or point in another direction -- I would
appreciate it. Thanks.