cbo after update to update a list box

dhunter

Registered User.
Local time
Today, 13:28
Joined
Jul 1, 2009
Messages
26
I have one table. I have a combo box to select a company name. Once the company name is selected, I want a listbox to be updated with only the column information pertaining to that company. For example, I choose a company called ABC and the list box shows all the SOW's for ABC.

Here is the code I have:

Private Sub cbo_Customer_AfterUpdate()
Me.lbo_SOW_Num.RowSource = "SELECT tbl_ALL_SOW.SOW_Num" & _
" FROM tbl_ALL_SOW" & _
" WHERE tbl_ALL_SOW.Customer = " & _
Me.cbo_Customer & _
" ORDER BY tbl_ALL_SOW.SOW_Num"
End Sub

This works however it seems to be passing as a parmeter. When I select a company, a box pops up with that company's name. If I retype in the name it will display all the SOW for that company. I don't want to have to retype the company again.

To reiterate, I want to select a company from the cbo, the lbx only displays the SOW from that selected company. Both are in the same table. There can be multiple SOW for one company.

Please help!
 
Your code is valid for a numeric data type, and it sounds like you're typing text. Try

Me.lbo_SOW_Num.RowSource = "SELECT tbl_ALL_SOW.SOW_Num" & _
" FROM tbl_ALL_SOW" & _
" WHERE tbl_ALL_SOW.Customer = '" & _
Me.cbo_Customer & _
"' ORDER BY tbl_ALL_SOW.SOW_Num"
 

Users who are viewing this thread

Back
Top Bottom