Discussion Locked

enable/disble check-textboxes

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

im stuck on another access problem. I didnt write this data base and never profesed to be an expert. But anyway i need a way to figure out how someone ELSE placed check box fields on a form with text box fields corresponding, and had them enable as a result of other check boxes being checked off. To put it simply. You check off a box that says that a particular form was received and put in the date/time it was received in the corresponding text box. Then about 7 other check box fields with textboxes that were previously greyed out will then be enabled, then based on what you check in those boxes, others will enable elsewhere. Can someone please help. There is already an event procedure in place somewhere, but i think its all VB and i dontknow how to find or replicate what the writer did. I need to add more check/textbox fields to this same form and they need to funcion just like the other ones do.

please help

djoubert@earthlink.net

1 reply

by karpi

Hello,

I will try to explain the enabling and disabling of controls with code.

Place the Controls(Checkboxes) on the form and name them accrodingly.

Now mark a Checkbox. In the Properties window look for the OnClick-Event. Choose event-procedure and click on the button right to it.
You will be presented with an empty MyCheckbox_OnClick()-Event procedure.

Now you can enter some code:

Sub .............

'Determine the Value of the Checkbox and do some action according to the value
'Here if checkbos is checked
If Mycheckbox.value then
'Check a box and enable a textfield
MyOtherCheckbox.value=true
'Call the MyOtherCheckbox-OnClick-Procedure
call MyOtherCheckbox_onClick()
MyOtherTextfield.enabled=true
'... Maybe other actions
else
MyOtherCheckbox.value=false
MyOtherTextfield.enabled=false

endif

end sub

But beware: This procedure doesn't trigger the OnClick-Events of the other Checkboxes. You hav to callthe OnClick-procedure of the changed checkboxes.

To view the written Code, select the control and have a look in the Properties form.
To understand what happens in the other procedure you can mark a line of code (except DIM and REM-Statements) and set a breakpoint with the F9-key

HTH
Karpi

This discussion is closed to new replies.