ukdane
11-25-2009, 06:54 AM
Is it possible to dynamically copy a textbox or a combobox at runtime?
I have a series of textboxes on a form for user input, and thats fine if they only need to put in data for one item.
However at the time of programming, I don't know how many items the user will need to include data for.
What I was thinking was if when the code starts, the user inputs the number of items.
Can VBA copy the textboxes (named unit01, date01, time01) and the combobox (named combo01) for each additional item, and rename the textboxes and combobox as unitxx, datexx, timexx comboxx where xx refers to each item.
So if there were 4 items, I would end up with 16 boxes in all (unit01, unit02, unit03, unit04, date01, date02, date03, date04, time01, time02, time03, time04, combo01, combo02, combo03, combo04)
Is this possible, or is it a can of worms?
Also when the data has been collated and used, and the form closed down, it would need to revert to just one row of textboxes and combobox (still called unit01 etc etc)
I have a series of textboxes on a form for user input, and thats fine if they only need to put in data for one item.
However at the time of programming, I don't know how many items the user will need to include data for.
What I was thinking was if when the code starts, the user inputs the number of items.
Can VBA copy the textboxes (named unit01, date01, time01) and the combobox (named combo01) for each additional item, and rename the textboxes and combobox as unitxx, datexx, timexx comboxx where xx refers to each item.
So if there were 4 items, I would end up with 16 boxes in all (unit01, unit02, unit03, unit04, date01, date02, date03, date04, time01, time02, time03, time04, combo01, combo02, combo03, combo04)
Is this possible, or is it a can of worms?
Also when the data has been collated and used, and the form closed down, it would need to revert to just one row of textboxes and combobox (still called unit01 etc etc)