disable a field on form if a value is in another field

  • Thread starter Thread starter tom
  • Start date Start date
T

tom

I wrote VB code recommended by Wayne Morgan on 3/8/04 in
the AfterUpdate event of the control and in the forms
Current event. It is working but there is one glitch. I
need the value of one field to be disabled if there is a
value in another given field and vice versa - that works
with the below code. However if the value is a 0(zero)
it must recognize it as an empty field and still enable
the other one to be entered. Right now it is seeing it
as a value and so the other field is locked out. I need
to be able to put the 0 in so the calculation will work
out.


The previous subject on the help was:
disable a field on form if a value is in another field

Me.control2.locked= not isnull(me.control1)
Me.control1.locked= not isnull(me.control2)
Do you understand??

Please help.
Thanks,
Tom
 
Try one of the following variants.

Me.control2.locked = Nz(me.control1,0) <> 0

OR

Me.control2.locked= not (isnull(me.control1) or Me.Control1 = 0)
 
-----Original Message-----
Try one of the following variants.

Me.control2.locked = Nz(me.control1,0) <> 0

OR

Me.control2.locked= not (isnull(me.control1) or Me.Control1 = 0)



.
thanks I used the second one you recommended and it
works great.

Possibly any help on the other 2 above items by tom.

That's me. Please help.
Thank you,
Tom
 
Back
Top