Problem with List box query

  • Thread starter Thread starter Jim Pockmire
  • Start date Start date
J

Jim Pockmire

A query for a list box on a form has a parameter set by a value on another
form. Changes in the value on the form do not have an affect on the list box
query - that is until I open the form with the list box and "inspect" the
query. Then the list box query works fine. Can't figure it out.
 
Are you expecting that the listbox will change because the value on the
other form changes? It won't unless you issue a Requery for the listbox.
 
What do you mean by "'inspect' the query"? And are you sure your Requery is
firing?
 
By inspect the query, I open up the form in design view and then click on
the row source property for the list box, then go back to form view and the
list box is fine.

Regarding the query firing, I've stepped through the code for the requery
and the statement is executing.

There is undoubtedly something I am overlooking.
 
While you've single-stepped through the code, does it actually fire when
expected? It's not uncommon for procedures to get "separated" from the
control whose event is suppose to fire the code.

Is the row source for your listbox SQL or the actual query?
 
SQL. Your point is interesting.


Douglas J. Steele said:
While you've single-stepped through the code, does it actually fire when
expected? It's not uncommon for procedures to get "separated" from the
control whose event is suppose to fire the code.

Is the row source for your listbox SQL or the actual query?
 
I may have figured it out based on your idea that code can become detached.
I have a series of forms that use the same list box and I copied the SQL
from form to form.

I have since opened up each of the forms and executed the SQL for the list
box and then saved the form - it looks like it is testing out okay.
 
Good. Copying a control is one way that the code can get separated. You need
to go into the properties of the control, and make sure that it says "[Event
Procedure]" as the property for each event that's supposed to have code. I
gave code to automate the fix in my March, 2004 "Access Answers" column in
Pinnacle Publication's "Smart Access". You can download the column (and
sample database) for free at
http://www.accessmvp.com/DJSteele/SmartAccess.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top