ComboBox Question

Louise

Registered User.
Local time
Today, 07:18
Joined
Oct 28, 1999
Messages
26
I have a combo box for which the Record Source is an SQL Statement. What is displayed in this combo is the result of selections made in 2 other combos on the same form. All the SQL works fine. When I make my selections from the other combos, the correct (single) selection appears in the first combo.

The problem is only that I still need to click on the list arrow to show the resulting selection. There is only one item and I would like to have it display automatically in the combo.

I have been playing around with the ItemData() method but don't seem to be getting it right. Is this the right way to do it? Would it be better to do it with properties only or with code?

Or if anyone knows a better/easier way I'd love to hear it. Thanks!
 
How typical?! I post a question and then figure out the answer myself. I thought I would post the answer myself in case anyone else has had this problem.

The combo box (Commodity_Division) is dependent on 2 other choices from 2 other combo boxes. the second of those two has an afterupdate event that goes as follows:

DoCmd.Requery "Commodity_Division"
Me!Commodity_Division.Value = _
Me!Commodity_Division.ItemData(0)

That's all it needed.

Hope this helps someone else.
 
Actually even better than saying

DoCmd.Requery "Commodity_Division"

is:

Me!Commodity_Division.Requery

It runs faster that way because it doesn't have to close and then re-open the query from the database.
 
stumped on itemdata

I'm trying to test the itemdata function but having no luck...

I have a combo box ("cboSiteManagers") that has the ID, Fname, Lname

I've tried the following code
msgbox cboSiteManagers.itemdata(3)

But I get an error that says "Invalid Use of Null"...there are around a hundered entries in this dropdown so I don't understand why it would say null.

I'm looking to try to find an answer why my msgbox doesn't show info row rowindex number 3

Thanks in advance,,

Kacy
________
40DDKINKY
 
Last edited:
hi, i need the same basic setup as shown above, however, the data i need has not yet been saved into the combo and is currently in the blank space (user just typed it).

how do i get that to show.

jjames
 

Users who are viewing this thread

Back
Top Bottom