combo(s) to textfield

BubBob

Registered User.
Local time
Today, 22:09
Joined
May 20, 2003
Messages
10
Hi!

Siple question, at least i hope so; How can i combine information from (8) combos to single textfield. Better yet if i could add a separator like / between the text. Thanks for best access forum around.
 
The first idea that comes to mind would be to have a command button. In its on-click event:

Code:
Your_Command_Button_On_Click()
Me.YourTextbox=me.combo1 & "/" & me.combo2 & "/" & me.combo3 & "/".....& me.Combo8
End Sub

You may want to broaden this code a bit to check for any Null values in any of the fields before submitting them to the text box. Something like:

Code:
If isnull(me.combo1) or isnull(me.combo2) or.... isnull(me.combo8) then msgbox "Please make a selection in all of the boxes before submitting"
Exit Sub
Else:  The first bit of code
End Sub
 
Last edited:
You can make the solution even more concise if you name the combo boxes similarly, like combo1, combo2, etc....

Sub CombineComboBoxes()
Dim x as Integer
Dim str as String
  For x = 1 to 8
    str=str & Me("combo" & x)
  Next x
Me.textbox=str
End Sub


The code seemed to run fine also even if one of the combo boxes had a null value. OK, perhaps that really wasn't more concise!
 

Users who are viewing this thread

Back
Top Bottom