This is revisiting existing postings. I have a form to add new records and I need one field to increment by 1 based on the employee ID chosen in a dialog box. For each employee ID there can be unlimited Items, but each employee's items must start at 1 and increment from there. I set a LostFocus event on the field I want incremented as follows:
If Me.NewRecord Then
On Error Resume Next
Me.Item = Nz(DMax("[Item]", "tblThings", "[EmplID] = #" _
& Forms!frmAddThings!Employee & "#"), 0) + 1
The problem is it does nothing. It doesn't error and it doesn't populate anything in the [Item] field. When I debug the VB it goes from Me.NewRecord to the On Error Line and right back to the Me.NewRecord.
Thanks for any help on debugging this!!!
If Me.NewRecord Then
On Error Resume Next
Me.Item = Nz(DMax("[Item]", "tblThings", "[EmplID] = #" _
& Forms!frmAddThings!Employee & "#"), 0) + 1
The problem is it does nothing. It doesn't error and it doesn't populate anything in the [Item] field. When I debug the VB it goes from Me.NewRecord to the On Error Line and right back to the Me.NewRecord.
Thanks for any help on debugging this!!!