Enable/Disable

  • Thread starter Thread starter Denver
  • Start date Start date
D

Denver

Hi,
I have a checkbox [Discount]
with a default value:False
I write this code to disable some of my buttons on Click_event

If [chkDiscount] = False
[TxtDiscount Amt].Enabled = True
etc etc etc
Else
[TxtDiscount Amt].Enabled = False
etc etc etc

It works will but I want that [TxtDiscount Amt] will be
disable everytime I open the forms. and apply.Enabled when I click
on [chkDiscount] to YES


How can I do that or what else do i need to add from my code?
I am using access 2003

thanks for any help
 
What you need to do is to open the form in Design View, choose the
TxtDiscount Amt control and open the property sheet. Go to the Data table
and disable the control. Save the form.
 
It is possible to enable/disable the text box, using code in:
- the AfterUpdate event of the check box
- the Undo event of the checkbox/form
- the Current event of the form.

But in the end, is this really necessary? Why not drop the check box and
make the [txtDiscount Amt] default to zero? It would seem to me that this is
a safer system: it can't go wrong.

(Technically, storing an extra dependent field is a violation of
normalization.)
 
Thank you guys I learned many things from this post of mine

thanks anyway

Allen Browne said:
It is possible to enable/disable the text box, using code in:
- the AfterUpdate event of the check box
- the Undo event of the checkbox/form
- the Current event of the form.

But in the end, is this really necessary? Why not drop the check box and
make the [txtDiscount Amt] default to zero? It would seem to me that this is
a safer system: it can't go wrong.

(Technically, storing an extra dependent field is a violation of
normalization.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Denver said:
Hi,
I have a checkbox [Discount]
with a default value:False
I write this code to disable some of my buttons on Click_event

If [chkDiscount] = False
[TxtDiscount Amt].Enabled = True
etc etc etc
Else
[TxtDiscount Amt].Enabled = False
etc etc etc

It works will but I want that [TxtDiscount Amt] will be
disable everytime I open the forms. and apply.Enabled when I click
on [chkDiscount] to YES


How can I do that or what else do i need to add from my code?
I am using access 2003

thanks for any help
 
Back
Top