help walk me through query issue

tommy_mo

Registered User.
Local time
Today, 11:09
Joined
Oct 5, 2006
Messages
42
Hello-

I was wondering if there is a kind soul who is willing to help me redesign a query/ form so that it runs faster.

As it stands, I have a query based on 4 edit controls on my main form. The query results appear in a listbox. The query criteria have wildcards at the end of the the query so that partial entries still find the correct record ie. "Jo" finds "John"

From what I've read it seems that the query has to load every record to the listbox when the form first opens since the 4 edit controls that the query is based on are empty. So the forms takes about 30 seconds to load, which is way too long for me.

How can I redesign the form or query to either only run when I click a button to avoid the initial query when the form first opens, or come up with a better way to create the query?

I'm just learning VB so you'll have to forgive me if I'm not that clear. Cheers. -Tom
 
One way would be to remove the row source from the listbox so it loaded empty (some people would also hide it). Then set the source with your button (and make it visible if you hid it).
 
I have heard of doing that. Would something like the code below do the trick? Thanks. -Tom


Forms!Employees!cmboNames.RowSourceType = "Table/Query"
Forms!Employees!cmboNames.RowSource = "EmployeeList"
 
Last edited:
That should work, and you probably don't need the first line, presuming you save the form with that setting.
 

Users who are viewing this thread

Back
Top Bottom