Still need help with Combobox

L

lepricon

Still need some help with a combobox. I am trying to link 2 so that when you
select the info from one it limits the info in the other. I have gotten it
to do it, however it only does it it once. Meaning if you re-select
something in combo 1 it doesn't update in combo 2. Here is the code that I
am using. Anyone with specific help please let me know.

Private Sub Combo6_AfterUpdate()
Dim strSQL As String
strSQL = "Select " & Me!Combo4
strSQL = "charge code" strSQL & "Table1"
Me!Combo6.RowSourceType = "Table/Query"
Me!Combo6.RowSource = strSQL
End Sub
 
A

Andi Mayer

Still need some help with a combobox. I am trying to link 2 so that when you
select the info from one it limits the info in the other. I have gotten it
to do it, however it only does it it once. Meaning if you re-select
something in combo 1 it doesn't update in combo 2. Here is the code that I
am using. Anyone with specific help please let me know.

Private Sub Combo6_AfterUpdate()
Dim strSQL As String
strSQL = "Select " & Me!Combo4
strSQL = "charge code" strSQL & "Table1"
Me!Combo6.RowSourceType = "Table/Query"
Me!Combo6.RowSource = strSQL
End Sub

I assume you want combo6 to show only the chossen values from combo4 ?

then you have to use the Combo4_AfterUpdate to set combo6.rowsource

If you expect an answer to a personal mail, add the word "manfred" to the first 10 lines in the message
MW
 
W

Wayne Morgan

What is the value of Combo4? Which combo is the first in the chain?

Assuming the value of Combo4 to be 2, then the final SQL (strSQL) would look
like

charge codeSelect 4Table1

This is not a valid SQL statement.
 
A

Andi Mayer

I assume you want combo6 to show only the chossen values from combo4 ?

then you have to use the Combo4_AfterUpdate to set combo6.rowsource
oopps I didn't looked at the SQL_string

"SELECT chargeCode FROM Table1 "_
"WHERE chargeCode ="& Me!Combo4

assuming ChargeCode is numeric

BTW I hope you don't have a field with a blank in between

If you expect an answer to a personal mail, add the word "manfred" to the first 10 lines in the message
MW
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top