Combo box control?

Harry92

Registered User.
Local time
Today, 12:51
Joined
Apr 29, 2008
Messages
19
Hi
I have a combo box that shows four fields (Column A, B, C, and D) from the source table. I used the follow code below to output the three fields (Column B, C, and D) to three text box (TextBox1, TextBox2, and TextBox3).

This works great. Instead I would like to only show one field (Column A) in the combo box and output the three fields (Column B, C, and D) to the three text box (TextBox1, TextBox2, and TextBox3). I’m still learning but am I going about this all wrong?

Private Sub ComboBox1_AfterUpdate( )
Me!TextBox1 = Me!ComboBox1.column(1)
Me!TextBox2 = Me!ComboBox1.column(2)
Me!TextBox3 = Me!ComboBox1.column(3)
End Sub
 
Harry,
Go to the properties of the combo box. Under format go to column widths.
Type the widths of each column in your combo box. For instance if you only want to see the first columen type 3",0",0"0"

HTH
 
Harry,
Go to the properties of the combo box. Under format go to column widths.
Type the widths of each column in your combo box. For instance if you only want to see the first columen type 3",0",0"0"

HTH

Thanks sbooth, it works great.

I have one more request. To make this a simple example, in column A; I have “Yes” or “No”.

If “Yes” is selected, then the data from column B, C, and D appears and stored in the three textbox.

If “No” is selected, then I would like the three textbox to be grayed out and store the blank data in the table.

I don’t know how to code but here is goes below…

Private Sub ComboBox1_AfterUpdate( )
Me!TextBox1 = Me!ComboBox1.column(1)
Me!TextBox2 = Me!ComboBox1.column(2)
Me!TextBox3 = Me!ComboBox1.column(3)

If Me.ComboBox1 = Yes then
Me.TextBox1.Enabled = False
Me.TextBox1 = “ “
Me.TextBox2.Enabled = False
Me.TextBox2 = “ “
Me.TextBox3.Enabled = False
Me.TextBox3 = “ “
Else
Me.ComboBox1.Enabled = True
Me.ComboBox2.Enabled = True
Me.ComboBox3.Enabled = True

End If
End Sub
 
Last edited:

Users who are viewing this thread

Back
Top Bottom