Change multple controls based on option change



I have a situation where I need to display 10 to 20 questions with three
fields (approx 6 different forms). I'd like to create a single form and
populate it with
the 'maximum question count' worth of controls. Then use an option
button to select which questions get loaded and load the controls with the
appropriate values.

This way I only have one set of 'question controls' to deal with and can
create a function to call with the information to populate.

My big question is -- what is the best way to iterate through the 'question
controls' rather then naming each control? I will run a query to bring back
the data to load and also will need to hide any un-used questions. The
controls will be combox boxes and a text box


probably you want to consider visible/not visible rather than 'loading'....

it would be very straight forward to control which are visible....


Yes I planned on making the controls visible/not visible -- one process may
only require 12 questions -- so I would hide 8 (assuming I placed 20 of each
control on the form).

When I say load - I mean to query a table(s) to fill the contents of the
combo boxes and lables. The query for Option 1 will be different then Option
2 or Option 3 etc..

So, I envision writing a funtion that I would pass the option value to. The
function will run a query based on that value - bringing back the data set
(into an array) along with the total questions being asked. I would then
create a For-Next loop and 'load' the array values into the controls. The
looping value would be used to address the array location and the controls
(combo1, combo2...). How do I create the control name by combining 'Combo'
and the loop value? So, if I want to do something like label1.caption = "some
array value" ----- I need to take label and the loop value to make label1.
I am not sure how to do that.

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