Using And

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 
i realise now that you dont need the ands, stupid but when you dont know, you
dont know.

Sorry all
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top