Number 0 insted of Null when User erases a textbox (1 Viewer)

Fernando

Registered User.
Local time
Today, 17:38
Joined
Feb 9, 2007
Messages
89
I have several number type fields which i would like them to be equal to 0 each time the user erases (uses BackSpace) to clear it. What im doing is the following:

Code:
Private Sub txtBurden_AfterUpdate()
If IsNull(txtBurden) Then
    txtBurden = 0
End If
End Sub

My issue here is that i have to do it in every textbox, so maybe theres a better way to do this. thanks in advance :).
 

CEH

Curtis
Local time
Today, 16:38
Joined
Oct 22, 2004
Messages
1,187
How bout using the "Tag" property.......
In the "Tag" of each textbox put....for example an Asterisks "*"
Then......

Dim ctl as Control
For each ctl in Me.Controls
If ctl.Tag = "*" and isNull(ctl.value) then
ctl.value = "0"
end if
end sub

"air code" you might have to play with that.....but gives you the idea......
 

Users who are viewing this thread

Top Bottom