Update Combobox

L

lepricon

I am trying to get one combobox to update when you change the value of
another one. I.E. you change combobox 1 from a to b and combobox 2 changes
from 1&2 to 3&4. Also if you want to change back then it would do that. It
changes once but will not update after that. Here is the code that I am
using. Anyone have any ideas?


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

Allen Browne

This code is running in the AfterUpdate event of Combo6. It should therefore
be changing the RowSource of Combo7 or some other control instead of itself?

The SQL string does not look correct. Perhaps you can mock up a query that
does what you want, type in a sample value for the criteria, switch it to
SQL View (View menu, from query design), and copy what you see there.

You don't need this line:
Me!Combo6.RowSourceType = "Table/Query"
 

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