Question : How do I allow data entry under certain conditions in an access form

I want to block data entry in a field when another field is less than 70, but allow entry if the other field is over 70. I've been using the IIf function in the expression builder, and have been able to ask it to disallow data entry when the field is less than 70, but not sure how to finish the formula to ask it to allow data entry otherwise!

IIf([Gestation]<70," ",

Answer : How do I allow data entry under certain conditions in an access form

I'm afraid that in a continous form,the deafult operation is that formatting you apply to one record applies to them all.  
To get round this in some cases you can use conditional formatting on the Format menu to make the formatting specific to a condition in a record.

You can enable or disable controls using conditional formatting so that is what you can use in this case.
You apply the conditional formatting to the control containing the 'other field'.
Set the condition to 'Expression Is' and then add..
[Gestation] <=70
and set the formatting so that enabled is false.

You cannot set the field value this way.
If you need to clear the field then you have to use code like I gave before in the afterupdate of the gestation control..
If me.Gestation<=70 then
me.txtmyfield = ""
Else
End if


Random Solutions  
 
programming4us programming4us