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

Send SQL to query, update subform while open. Possible?

Status
Not open for further replies.

BotCow

Programmer
Jul 10, 2003
58
US
Okay, in an effort to make a form refresh instantaneously as soon as search criteria from an SQL statement is sent to the query isn't working so well. I though that putting a refresh button on the subform that houses the query would make it display but it doesn't. I even tried sending the SQL Statement and then opening the query in design mode. It doesn't change while the search form (the form sending the SQL) is open. When I close it, then it changes. So I'm thinking that the form must be closed for the query to receive the SQL statement?
 
I'm not sure the contents of your code, or your form. But try putting:

Code:
Me.Requery

If this doesn't work, maybe post a little of the code and I'll give it another try.
 
I don't know if it's the code though. Here's a more detailed explanation, maybe I can clarify some things.

There is a main form that houses one subform. The main form contains about 5 unbound text boxes. These boxes take any string the user wants to enter like, "dog" or "cat" and then searches the database for that word. These results are displayed in the subform below and the user can browse through all of them using record navigation. This search code is all done through the large "Custom Search" thread here at this forum. Basically it just constructs an SQL statement and passes it to the query. The subform's source is that query.

So basically I enter some stuff into the fields and click search. The result? Nothing at all happens. When I click the search button it has the code "Me.subform.refresh" (I've tried requery also) and it just "blinks" at me but doesn't actually update the data. When I open the query with the search form open, it displays the same SQL string as last time. But when I exit the search form, the SQL statement changes according to what I wanted it to be earlier. So my observation thus far is that the SQL statement doesn't change whilst the search window is open, therefore no matter how many times I refresh, it'll just refresh what was on the query earlier.
 
I stand corrected. When I send the SQL statement to the query it works. But the darn subform won't update to reflect the changes. I've tried everything, Me.subformname.Refresh (which gives me an error: Object doesn't support this method or property), Me.subformname.Requery, Me!... and finally making a separate button on the subform with both Me.refresh and Me.requery. Nothing works dangit.
 
So there is a button to click to send the search criteria to the query. And in the code for that button's on_click event is where the code doesn't work for me.subformname.requery?

That is odd. I have it on several of my forms and it works like a charm. I seem to be at a loss.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top