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

Help!!!!!!!!!!!

Status
Not open for further replies.

ind

Programmer
Mar 9, 2000
121
US
I have a textbox, listbox and command button on a search form. Then listbox consist of (4) columns: Customer ID, Company Name, Phone No. and Fax No. The bound column is (2) the Company Name. As you type the customer name in the textbox above the listbox, I want the listbox to correspond with the textbox. <br>
<br>
Example:<br>
If you type &quot;M&quot; int the textbox, the listbox would move to the first record beginning with &quot;M&quot;.<br>
<br>
The command button is used to select the entry.<br>
<br>
This is sort of like autofill in a combobox. <br>
<br>
How do I do this
 
Keep in mind for future posts tha HELP is not very descriptive for a Subject. It's mentioned somewhere on this site.<br>
What you want to do only works in the first column.<br>
<br>
So move Company Name to column 0 which is the first column and make it the bound field, to keep that straight as well.<br>
<br>
<p> DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br>
 
Thanks for the tip.<br>
<br>
But I still don't understand how to make the textbox and listbox correspond with one another.<br>

 
Another idea is perhaps you want to store one field and display another. Normally if you have an ID field (such as companyID), that's the field you actually want to store in another field in order to link to it, but you want to display an associated value (like CompanyName) because it's what the ser would relate to. In this case, you would have CompanyID in the first column, which would also be the bound column, and make the width of the fist column (under column widths) zero. That way the second column (CompanyName) will display in the combo after the selection is made.
 
I've got the bound column right. I just don't know haw to make the listbox scroll in accordance with the textbox.<br>
<br>
I also want the entire list of all my customers listed in the listbox when the form is opened.
 
1. What do you mean &quot;scroll in accordance with the textbox&quot;?<br>
Do you want to pick an item in the List box as you type info in a Textbox?<br>
<br>
2.Well the entire list is done in the Row Source<br>
like so:<br>
SELECT DISTINCTROW [Contacts].[ContactsID], [Contacts].[FirstName], [Contacts].[LastName] FROM [Contacts];<br>
<br>
So there is NO &quot;Where&quot; clause<br>
<br>
Use the Build button the &quot;Three dots&quot; button to create your Row source<br>
Or just delete the listbox and create a new one.<br>
<br>
<br>
<br>
<p> DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br>
 
I'm assuming the textbox is named Text2 and the listbox is called List0.<br>
<br>
In the Change event of the textbox, put this code:<br>
<br>
Private Sub Text2_Change()<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;For i = 0 To List0.ListCount - 1<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If List0.ItemData(i) Like Text2.Text & &quot;*&quot; Then<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;List0 = List0.ItemData(i)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Exit For<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End If<br>
&nbsp;&nbsp;&nbsp;&nbsp;Next i<br>
<br>
End Sub <p>Jim Conrad<br><a href=mailto:jconrad3@visteon.com>jconrad3@visteon.com</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top