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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a drop down in a form using a parameter query 1

Status
Not open for further replies.

CDaly

Technical User
Aug 5, 2004
8
0
0
IE
I am trying to set up a database of customer information and I am trying to set up a drop down with all companies beginning with a certain letter. For example, if you know your company begins with the letter B, you key in B and all of the companies beginning with that letter come down.

Thanks,
Claire
 
A regular drop-down or combo box in Access will go to the B's if you type the letter in the box. This would be the easiest way to handle this. You can force the combo box to dropdown as soon as they hit a key if you add this to the KeyPress event of the combo box

If KeyAscii <> vbKeyTab Then
Me.comboboxname.Dropdown
End If

You also have to change the KeyPreview property of the form to be Yes.



Hope this helps.

OnTheFly
 
To do what you are asking would require that you requery your RowSource each time someone typed a letter. If some one typed "b" then the rowsource would dymanically change to "SELECT MYFIELD FROM MYTABLE WHERE MYFIELD LIKE 'B*'". Then on the very next key stroke if they typed "r" then it would have to change to "SELECT MYFIELD FROM MYTABLE WHERE MYFIELD LIKE 'BR*'? This would be stressful on your process.

Why not have your RowSource sorted in ascending order, turn on the autoexpand property and put a dropdown command in the combo boxes On Change event? This would take them to the B's when they typed B and also show the list there after. If they typed BR then it would take them down to the section with the BR still showing the list.

Hope this helps.

ProDev, MS Access Applications
Visit me at ==>
May God bless you beyond your imagination!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top