Kaja
Kaja

Reputation: 3057

Combobox Click event challenge

sorry for my primitive question, may be you could help me :)

I have a combobox on my form. If I click on it, I am seeing such a Information:

enter image description here

under On Click event of combobox I am seeing no codes, which fills this Combobox. The only used events are On Got Focus and After Update.

On Got Focus:

Private Sub ctl42_GotFocus()
    Call subPfadFilter(ctl42, "Obd2")
 End Sub

and After Update event runs a macro

this combobox is bounded to a source:

enter image description here

My aim is to simulate this action with vba code. If I click a button on a the form, then I want to see what in the first figure. How can I do that?

Upvotes: 0

Views: 582

Answers (2)

maxhugen
maxhugen

Reputation: 1944

There's no such thing as a primitive question :) We all had to start from ground zero!

Your question is a bit difficult to understand as to what you really want to do, so a few comments:

  1. I assume your combo ctl42 actually returns results - ie, the list part of the combo has rows in it?

  2. The event you need is "On Click", not "On Got Focus". Delete "Private Sub ctl42_GotFocus()" from your code. In the properties for the combo, select Events tab, then in the "On Click" field, which is a combo, select [Event Procedure], then click on the ellipsis (...) at the right hand side, and Access will create an empty sub for you in the code-behind-form module. That's where you need to put your function call - Call subPfadFilter(ctl42, "Obd2").

  3. Your function subPfadFilter presumably filters your subform. If that's not working either, you may need to post the code for that here.

HTH

Upvotes: 1

izzymo
izzymo

Reputation: 936

Looking at the image it appears that on clicking the ComboBox you are seeing a list of values to select from. I am not able to zoom into the image so I am not very sure, but if that is correct. It should be quite simple to replicate even without VBA.

You can click on the small box (...) at the end of the Control Source and it will open a query window for you. Select all the columns you want the box to display on click. and make sure you goto the Format Page and set the column count to the actual number of columns that you select lets assume 4 and then set the width of each column and set Column Heads to Yes

Format Property Column Count = 4 Column Widths = 0.5;0.5;0.5;0.5 Column heads = Yes

Upvotes: 0

Related Questions