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.
 
sorry. i got an error when i tried to post this message, so i posted it again. i don't see any retract options, so i appologize for the redundancy.

mjnaeblis
 
I know this is obvious, but are you using step -1?
As in:
For a = Text1.UBound To 1 Step -1
Unload Text1(a)
Next

This works for me! Let me know if this helps
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'There are 10 kinds of people in the world: those who understand binary, and those who don't.'
 
Usually, when you get this error when trying to unload something, you are trying to do it in a place in code that you are not allowed to. How is the user selecting the next query result, and in what proceedure is your code to unload the text boxes?

Robert
 
yes, robert, i was.

my code was correct. however, i was trying to unload from a combobox click event. this is not allowed (which escapes my logic).

anyway, i just switched to a listbox and it works just fine. thank you

everything was worked out in thread 222-112214

mjnaeblis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top