default no. and forms

colenzo

Registered User.
Local time
Today, 19:03
Joined
Jun 2, 2010
Messages
42
hi guys,

probably a stupid question, but i have a series of number fields on a form, which are all defaulted to 0 (through the table for consistancy's sake).

however, when i test the form, you have to wipe the 0 out before entering the figures required.

is there any way of having the default 0 "disappear" when the number box is tabbed to / active on the form.

I'm trying to keep the form simplfied for a beginner user and don't really want any mistakes happening should the 1 (for example) ends up on the wrong side of a 0 and i get 10 instead of 01 (which i know access will handle down to a single 1)

thanks for your patience :)
 
You could us the following code in the Field's On Got Focus event;
Code:
If Me.FieldName = 0 Then
     Me.FieldName = Null
End If
Then to ensure that the field is not left as Null use the following in the Field's On Lost Focus event;
Code:
If IsNull(Me.FieldName) Then
     Me.FieldName = 0
End If
 
Just a slight addition, you will need to check for NewRecord as well.
Code:
if me.newrecord then
    If Me.FieldName = 0 Then
         Me.FieldName = Null
    End If
end if
 

Users who are viewing this thread

Back
Top Bottom