Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Default Value Problem

Status
Not open for further replies.

THEJOESTER

Technical User
Jul 6, 2006
39
US
Hi, I am creating a form and I need it so when you leave a field, it automatically puts a zero in there. I have tried to do this with properties of the textbox "Default Value is 0" I have also put the default value to 0 in the table but when I leave the textbox blank it's just blank, A zero does not appear, how could i make this work?
 
How about:

Code:
Private Sub Location_Exit(Cancel As Integer)
If Trim(Me.txtText & "") = "" Then
    Me.txtText = 0
End If
End Sub
 
Hey Sorry I didn't think of it, all i did was do a "on lost focus" on the text box and the wrote this code:

If txtbox.text = "" Then txtbox.text = 0
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top