Solved Setting a field to null on Dirty

dullster

Member
Local time
Today, 03:10
Joined
Mar 10, 2025
Messages
213
I'm trying to change a Text Box "OT Hours" to null when i go to a new or next record.

I have tried this on the form and field Expression and it's not working.

Private Sub Form_Dirty(Cancel As Integer)
If Me.OT_Hours Then Me.Undo
End Sub

Private Sub OT_Hours_Dirty(Cancel As Integer)
If Me.Dirty Then Me.Undo
End Sub
 
Dirty only happens when you Dirty the form (make an entry)

try the current event with Me.OT_Hours = Null
 
That worked. Thank you. You guys are amazing when I can't work through stupid errors.
 
The field is only a number field that i enter overtime hours for the employee to show me how much is owed for overtime. I enter the hours in the field and have another field that tells me how much overtime to pay. It does not fill another field with information. Next payroll, the employee may not have overtime so I want it to 0 when the form is closed.

I am not seeing a 0, the number I entered to calculate the overtime stayed in the field. I want it to go back to blank or 0.
 
Sorry, my error. I'm still trying to figure out the forum. I marked it as solved.
 

Users who are viewing this thread

Back
Top Bottom