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!!
SusanV - 20 Jun 2007 14:26 GMT
If Nz(Me.YourControl,"") = "" Then
Me.YourControl = 0
End if

Signature
hth,
SusanV
>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!!
Slez - 20 Jun 2007 14:35 GMT
Thanks for the reply!
Slez
>If Nz(Me.YourControl,"") = "" Then
> Me.YourControl = 0
[quoted text clipped - 5 lines]
>>
>> I would appreciate any help!!
Arvin Meyer [MVP] - 20 Jun 2007 14:33 GMT
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

Signature
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.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
[quoted text clipped - 7 lines]
>
> I would appreciate any help!!