Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to drop down combo box when typing in a number 3

Status
Not open for further replies.

psehudson

Programmer
Jan 30, 2008
9
US
I'm using Acess 2000 and I would like to have the combo box automatically drop down when I start typing in a number. I found this thread with the answer:

thread736-415985

However, when I run the line

Code:
Call SendMessage(cb_phone_lookup.hWnd, CB_SHOWDROPDOWN, 1, ByVal 0&)

VB gives me a compile error that the cb_phone_lookup.hWnd "method or data member is not found". Do I need to set up a library reference to get this to work? I have the following references:

Visual Basic for Applications
Microsoft Acess 9.0 Object Library
OLE Automation
Microsoft DAO 2.5/3.51 Compatability Library


Thanks in advance!
 
Why not simply set the AutoExpand property of the combo to True ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Reread your thread
I am converting an Access program to VB 6.0.

The code is for a vb combo not an Access combo.
 
The AutoExpand property is set to TRUE, but it does not automatically drop down.

I see that it is for VB 6, but I assumed it would work the same way (that's what comes from an assumption :).

To give a more detailed example:

I have a combo box with a list of phone numbers. If the box starts out as blank, and I type area code 865 into the box, it will fill with the first phone number that starts in 865. If I then click on the down arrow on the right side of the combo box, it will show all numbers starting with 865. I would like to have the same effect as clicking the down arrow when I have typed in 865, without having to click the down arrow. How is this done for Access 2000?
 
The dropdown property should do what you want. You may have to call it from more than one event.

Private Sub cmboOne_Change()
Me.cmboOne.Dropdown
End Sub

Private Sub cmboOne_Enter()
Me.cmboOne.Dropdown
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top