change null to a value of 0

  • Thread starter Thread starter Slez via AccessMonster.com
  • Start date Start date
S

Slez via AccessMonster.com

I have a control on a form with a default value of "0" that users have
occasionally started to change the value in the control, but then exit the
form with a Null value. This affects various reports that include this data.


I'd like to have the value return to 0 either in the event they exit the
control without typing in a value. I am assuming it would require code in
the On Exit Event of that control, but I am not sure what code would
accomplish this.

I would appreciate any help!!
 
Try something like this in the control's after update event:

Sub MyControl_AfterUpdate()
If Len(Me.MyControl & vbNullString) = 0 Then
Me.MyControl = 0
End Sub
End Sub
 
Thanks for the reply!
Slez
If Nz(Me.YourControl,"") = "" Then
Me.YourControl = 0
End if
I have a control on a form with a default value of "0" that users have
occasionally started to change the value in the control, but then exit the
[quoted text clipped - 7 lines]
I would appreciate any help!!
 
Back
Top