Using And

F

Fab

Could someone please tell me should this code work?

If DE.Value = No Then
KeyDE.Enabled = False And DEAddress.Enabled = False And DETel.Enabled =
False And DEEmail.Enabled = False And DEP_Subform.Enabled = False And
DEPbtn.Enabled = False And DPbtn.Enabled = False
Else: KeyDE.Enabled = True And DEAddress.Enabled = True And DETel.Enabled =
True And DEEmail.Enabled = True And DEP_Subform.Enabled = True And
DEPbtn.Enabled = True And DPbtn.Enabled = True
End If

And If not what is the best way of going about this

Any help appreciated

Thanks
 
K

Keith Wilby

Fab said:
Could someone please tell me should this code work?

If DE.Value = No Then
KeyDE.Enabled = False And DEAddress.Enabled = False And DETel.Enabled =
False And DEEmail.Enabled = False And DEP_Subform.Enabled = False And
DEPbtn.Enabled = False And DPbtn.Enabled = False
Else: KeyDE.Enabled = True And DEAddress.Enabled = True And DETel.Enabled
=
True And DEEmail.Enabled = True And DEP_Subform.Enabled = True And
DEPbtn.Enabled = True And DPbtn.Enabled = True
End If

And If not what is the best way of going about this

Any help appreciated

Thanks

If DE.Value = No Then
KeyDE.Enabled = False
DEAddress.Enabled = False
DETel.Enabled = False
DEEmail.Enabled = False
DEP_Subform.Enabled = False
DEPbtn.Enabled = False
DPbtn.Enabled = False
Else
KeyDE.Enabled = True
DEAddress.Enabled = True
DETel.Enabled = True
DEEmail.Enabled = True
DEP_Subform.Enabled = True
DEPbtn.Enabled = True
DPbtn.Enabled = True
End If

HTH - Keith.
www.keithwilby.com
 
F

Fab

i realise now that you dont need the ands, stupid but when you dont know, you
dont know.

Sorry all
 
M

Marshall Barton

Fab said:
i realise now that you dont need the ands, stupid but when you dont know, you
dont know.

Sorry all


Note that No is not a built in value. Maybe you want to use
False instead?

Also, you can set the enabled property appropriately with
out using an Else statement. Assuming that your No is
really False:

KeyDE.Enabled = DE
DEAddress.Enabled = DE
DETel.Enabled = DE
DEEmail.Enabled = DE
DEP_Subform.Enabled = DE
DEPbtn.Enabled = DE
DPbtn.Enabled = DE
 
Top