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!

Text and List Box Synchronization

Status
Not open for further replies.

ind

Programmer
Mar 9, 2000
121
US
How do I synchronize a list box value with a text box?
 
Go into the Listbox's RowSource (Data Tab of the Property Sheet). Click on the (...) button next to that property, and look at the query behind it. You'll want to add a criteria on the Selection Criteria line of the query grid that refers to the textbox. Fo it in this format: Forms!YourFormName!YourTextboxName<br>
<br>
Run the query to make sure you get what you want.
 
This works fine, but I want the ListBox to show the list of the records in the ListBox. Then as you type in the text box, I want the ListBox the synchronize with the text in the text box.<br>
<br>
<br>
Thanks for your help
 
Go into the AfterUpdate event of your <b>text</b>box and add this line of code, substituting the name of your actual <b>list</b>box:<br>
Me!YourListtBox.Requery
 
How about this as type in the text box I want the ListBox to correspond with the text box.<br>
<br>
Example:<br>
<br>
If you type the letter &quot;c&quot; in the text box, I want the ListBox to move down to the first &quot;c&quot; in its recordsource.<br>
<br>
Thanks again for all your help
 
If you put the same code in the textbox's OnChange event, it will requery after each keystroke.
 
Oops, just realized you won't have an exact match. You'll have to use the like operator in the criteria column of your query.
 
Ok I'm lost. <br>
<br>
Can you please give me some sort of an example
 
In your query, substitute:<br>
like Forms!YourFormName!YourTextboxName and &quot;*&quot;<br>
for<br>
Forms!YourFormName!YourTextboxName<br>
<br>
The like operator allows you to use * as a wildcard when you're specifying a selection criteria in a query. You can put the &quot;*&quot; before, after, or both before and after a value.
 
elizabeth,<br>
<br>
<br>
Thanks you so very much, it works beautifully.
 
elizabeth,<br>
<br>
When I tried to use the example in a .adp file (access project) I got the following error message with I typed anything into the textbox:<br>
<br>
Object Variable or With Block Variable Not Set<br>
<br>
It worked fine in a .mdb file.<br>
<br>
What an I doing wrong.<br>
Is there a reference that I need to make, or what????
 
Sorry, I don't know much about projects and I see that another person (ind) posted with a similar question lately, and it has gone unanswered. When I typed that error message into the MS search engine, it found this article <br>
<br>
<A HREF=" TARGET="_new"><br>
that said this sometimes happens when using the Package and Deployment Wizard:<br>
&quot;You receive the error &quot;Object variable or With block not Set&quot; when you click<br>
the Package button. Click OK to ignore this error and continue. &quot; <br>
<br>
Please post if you find an answer!
 
Oops, I didn't notice it was you who posted the question both times! :}
 
I'm not using the Package and Deployment Wizard. I assume that this is part of the Office Developer Suite, which I unfortunately do not have.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top