Combobox Weird Behaviour

S

Skullshock101

I have 2 comboboxes cbo1 and cbo2. cbo1 populates the cbo2 in the
AfterUpdate of cbo1, where cbo2 is assigned as follows:
cbo2.RowSourceType = "Table/Query"
cbo2.RowSource = strSql (strSql is a simple select query, depending on the
selected value of cbo1)

The above combos worked fine for the past few weeks while I continued
developing my database application. But today, cbo2 did not populate, or
maybe it did populate behind the scenes but it did not display the values (i
know because the drop down box height varied depending on the number of items
returned by the query). I checked for other events that may have screwed up
the combo list but now was found. To make it worse, another pair of
comboboxes with the same functionality on another form exhibited the same
behaviour, which made me conclude that the problem was not local to the first
pair of combo boxes. Could it may be an Access problem? I read about a
similar problem on another forum but the thread ended without a solution.

I've given up looking for the culprit. Can anybody please help? Thanks in
advance.
 
K

Klatuu

Actually changing the rowsource is not necessary. The better technique is to
filter cbo2 on the content of cbo1. For example:

SELECT SomeField, AnotherField FROM SomeTable WHERE AnotherField = cbo2

Then in the After Update event of cbo1, requery cbo2

Me.cbo2.Requery
 

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