Check Box default

jojo86

Registered User.
Local time
Today, 19:54
Joined
Mar 7, 2007
Messages
80
I have check boxes that enable and disable text boxes on one of my forms. However, I am having trouble getting it to stick to being checked when I close the form.

For one of the check boxes, this is the code:
Code:
Private Sub extent_AfterUpdate()
If Me.extent = True Then

     PP_SITE_CAP.Enabled = True
     PP_DW_COMP.Enabled = True
Else
     PP_SITE_CAP.Enabled = False
     PP_DW_COMP.Enabled = False
End If

End Sub

This is on the After Update for the check box and also in the On Current event for the Form itself. When I open the form, the default is not checked, so no text boxes are enabled (which is what I want). However, if I check this box and save and close the form, then open it again, its not checked anymore (but whatever was put in the text boxes are still there, just not enabled).

Can anyone help me with this?
 
Is your check box bound to a field in the table so it would be able to store the value?
 
When I open the form, the default is not checked, so no text boxes are enabled (which is what I want). However, if I check this box and save and close the form, then open it again, its not checked
you just said that's what you want. :confused:
 
The check boxes is unbound, but it affect more than one text box (this particular one affects two text boxes).

And sorry wazz, I meant to put "When I open the form to enter a new record, the default is not checked" which is what I do want. However, when I open the form again to that (or any) record (after checking it), it appears unchecked and the text boxes are disabled.

Thanks for your help on this :)
 
The check boxes is unbound, but it affect more than one text box (this particular one affects two text boxes).
If you want Access to know to have the checkbox checked when you open the form, you will have to store the value in a table somewhere.
 
Thank you :)

Another question regarding the enabling of text boxes, can an unbound text box be added to the code above? I have another text box that is unbound and is used to just do a simple calculation between two text boxes (which are affected by the check box). However, I would like to make that disabled/enabled when I uncheck/check the box.

Is this possible?
 
Thank you :)

Another question regarding the enabling of text boxes, can an unbound text box be added to the code above?
Yes, it can.
I have another text box that is unbound and is used to just do a simple calculation between two text boxes (which are affected by the check box). However, I would like to make that disabled/enabled when I uncheck/check the box.

Is this possible?
Yes, totally.
 
I have put it in the code but it doesn't disable them. However, I think this may be something to do with the fact that the unbound text boxes are locked; 1 is locked so no one can change the value after the calculation has been done and 1 is locked so no one can change a look up value calculated from other combo boxes.
Thank you for your help though, I have appreciated it!
 
I have put it in the code but it doesn't disable them. However, I think this may be something to do with the fact that the unbound text boxes are locked; 1 is locked so no one can change the value after the calculation has been done and 1 is locked so no one can change a look up value calculated from other combo boxes.
Thank you for your help though, I have appreciated it!

Actually, it isn't dependent on the locked property. But, if you set a control to Locked = yes and Enabled = No then it will be locked and you can't click in it, but it won't gray out. If you don't lock it and disable it then it will gray out.
 

Users who are viewing this thread

Back
Top Bottom