Default Value

lead 27

Registered User.
Local time
Yesterday, 20:57
Joined
Mar 24, 2007
Messages
147
Hi

I have a number field which controls a yes/no box (basically if the number is greater than 0 the box is ticked). However I have just discovered a problem, if the user just deletes the number rather than putting a 0 in teh box it wont change my yes/no field to no.

How can I have it so that if there is nothing in the box 0 is displayed? I tried Default value but couldnt get it to work.

Thanks
 
Why have the yes/no field at all? It is basically a calculated value, and the problem you're having is why it's recommend to not store calculated values. You could simply use an IIf in queries, forms or reports that examines the number field and returns yes/no or whatever you want. In any case, you could put code in the after update event of the control containing the number field and set the checkbox accordingly.
 
Hi
thanks for replying. The code that I have already on the after update event is:
If Me.QTY1 > 0 Then
ON_DEMAND = True
End If
If Me.QTY1 < 1 And QTY2 < 1 Then
ON_DEMAND = False
End If

This works fine unless there is no number in the box.
 
Sorry for the delay; I have been out of town. Did you get this resolved? For an empty control, you need to test for Null and ZLS:

If Nz(Me.QTY, "") = "" Then
 
Hi
All that I have done is made the field required that way they have to input a number so hopefully they will use their common sense

Thanks for following up
 

Users who are viewing this thread

Back
Top Bottom