Which event Should I use as a trigger?

brharrii

Registered User.
Local time
Today, 10:08
Joined
May 15, 2012
Messages
272
I have a specification database that collects size information of a given product. Sizes can be entered as an integer into min / max fields, or they can be classified as "Varies" with a yes/no checkbox. On my form, I'd like to disable the min / max fields when the Varies check box is clicked and set to yes, and I'd like to re-enable them if the checkbox is later clicked to no. I'd also like for the enabling / disabeling to happen when the form loads so that when a record is pulled up the fields are disabeled if the records "Varies" value is set to True.

Do I need to set my code up to run based on the "onclick" event of the check box and the "onCurrent" event of the form? is it possible to set it up in only one place?

Thanks!
 
I think the necessary code will need to run in the Forms OnCurrent event and I would suggest also in the AfterUpdate event of the check box. You could create a sub procedure to hold the code that actually changes the control properties of the text boxes and "Call" it from the other two events.
 
Ok, that's kind of along the lines of what i was thinking, so it's nice to know I was at least on the right path :)

I haven't ever called a procedure before like you describe... it's one of those things things I've had on my "to learn" list for a while now... It looks like this will be a good oportunity to take it on
 
While you could use a sub procedure the code required to change the visible property of each text box is only one line. Something like:
Me.[NameOfTextbox].Visible = Not Me.[NameOfCheckBox].Value
 

Users who are viewing this thread

Back
Top Bottom