在组合框的对面.下拉法? [英] Opposite of combo box .Dropdown method?

查看:71
本文介绍了在组合框的对面.下拉法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过VBA切换组合框的下拉菜单? .Dropdown是一种方法,仅在一个方向上起作用.我正在寻找以下功能:

Is there a way to toggle the dropdown of a combo box through VBA? .Dropdown is a method and it only works in one direction. I'm looking for the following functionality:

MyCombo.Dropdown = True
MyCombo.Dropdown = False

显然,以上内容在MS Access中不起作用.我猜想我需要为此使用某种hack/解决方法.我想避免使用.Requery.这可能会起作用,但是根据组合框的来源,可能会导致重大的性能损失.

Obviously the above does not work in MS Access. I'm guessing I'll need to use some sort of hack/workaround for this. I'd like to avoid a .Requery. That would probably work, but there could be a major performance penalty depending on what the source of the combo box is.

推荐答案

我今天正在处理此问题,经过大量的试验和错误,我发现以下内容在Access 2010中可以很好地工作:

I was dealing this this issue today, and after a lot of trial and error, I discovered that the following works beautifully in Access 2010:

With m_cboLookup
    .ListWidth = .ListWidth    ' Close combo box
    'If Len(strSearch) > 3 Then .Dropdown
End With

基本上,您只是将列表宽度设置为现有列表宽度,但是组合框已关闭,可能是为准备以其他尺寸重新绘制.

Essentially, you are just setting the list width to the existing list width, but the combo box is closed, presumably to prepare for redrawing at a different size.

这篇关于在组合框的对面.下拉法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆