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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

filling a textbox from a collection of other boxes

Status
Not open for further replies.

tazardous

Programmer
Aug 22, 2002
58
0
0
US
I've looked high and low and I apologize up front if someone's offered a solution already to my problem and I just missed it during searching these forums.

My problem is that I need to collect the selections of several dropdown combo boxes in a form and put them into another field on the form IN A CERTAIN ORDER.

I thought my approach would be to create some structure to store the values and then always just display the output in a large text box, but since I haven't found anything to 'point me the way', I don't even know if that's the right approach.


 
Hiya,

You might be able to use something like this...
set up however many combos you need Combo1, Combo2...
' Make Txt1 a textbox where you display your combo's selections

If you want this data to be displayed when you click a button, then write something like

Private sub DataButton_Click()

Dim Str1 as String

Str1 = nz(Combo1.Column(0), "no data in Combo1")

Str1 = Str1 & ", " & nz(Combo2.Column(0), "no data in Combo2")

Str1 = Str1 & ", " & nz(Combo3.Column(0), "no data in Combo3")

Str1 = Str1 & ", " & nz(Combo4.Column(0), "no data in Combo4")

Txt1 = Str1

End Sub

Best,

C
 
You simplify cgarts answer by just putting his expressions together in the ControlSource property of the text fox.

Code:
=nz(Combo1.Column(0), "no data in Combo1") & ", " & nz(Combo2.Column(0), "no data in Combo2") & ", " & nz(Combo3.Column(0), "no data in Combo3") & ", " & nz(Combo4.Column(0), "no data in Combo4")


Bob Scriver
[blue]Want the best answers? See FAQ181-2886[/blue]


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top