Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unloading Textboxes?

Status
Not open for further replies.

MJnaeblis

Programmer
Aug 14, 2002
19
US
hi.
what i am trying to do is populate a form with textboxes that hold data from a recordset. each record (yielding one field) is put into a textbox array.
i have the first, txtBox(0), on the form in Des.Time, then as the user selects the query options, the form populates with the textbox array according to the recordset results.
Loading the next consecutive controls in the txtBox() array is not giving me any problems at all. however when the user selects another query result, i try to Unload the textboxes so i can reload them according to the new recordset count. This unloading is giving me the error. I am unloading backwards (Ubound to 1), keeping the txtBox(0) still on the form.
The error i get is: <Cannot unload in this context.>
i don't know what the context is about, so i'm clueless.
any suggestions would be much appreciated.

thanks.
mjneablis

ps. i realize that a grid of any kind would solve my problems, but unfortunately i must design the form in this manner.
 
One solution would be to design a second form that has
the new textboxes as you wish. Then a (old form).Hide
and a (new form).Show would allow you to instantly
replace the old form with the new one.
 
your solution would only work for me if i was not making an unknown amount of textboxes. this form needs to dynamically create a number of textboxes equal to the number of records.
there was actually nothing wrong with the code, only what was calling the code. i was trying to unload from a combobox click event. this is not allowed. i just switched to a listbox and it works just fine.

everything was worked out in thread 222-112214

mjnaeblis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top