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

How to make Combobox requery each time??

Status
Not open for further replies.

Moss100

Technical User
Aug 10, 2004
579
0
16
GB
Hello I have a form. On the form is a combobox that is linked to an address query.

The query has an address field with Like criteria, which requires the user to type in the first few letter of a road name.

This then returns the records that the user can select in the combo box.

This runs fine the first time the combo box is entered, but once it has been entered it remembers the last records.

Ie. If I enter the combo box the query prompts me to enter the first letters of the road name. I.e. I enter "whet"

The combo box then lets me select from road names starting with "whet"

If I change my mind and want to search for a different road name, entering the combo box only lets me select roads whet.

What is the best way to get the combo to run the query each time I select it?

Many many thanks Mark
 
In the GotFocus event procedure of the combo:
Me![combo name].RowSource = Me![combo name].RowSource

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
How are ya Moss100 . . .

PHV's solution is correct as long as the combobox doesn't already have the focus. This is your problem ... subsequent attempts to trigger the query. What you need is an event that will handle this, and the only ones I come up with are the click events. Namely: On Click & On Dbl Click. I perfer On Dbl Click because it shows more intent on the part of the user. Just transfer PHV's code there and see if you like it?

Your thoughts? ...

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top