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

requery

Status
Not open for further replies.

wxkeep

Programmer
Jul 5, 2005
57
US
Probably another simple question.

I have a form with a subform. The main form has a combobox on it. That combobox has a list of employees in it. The subform displays the result of a query based on an employee id number ( a primary key among the tables queried by the query). "SELECT <lots of things here> FROM <tbl> INNER JOIN <another table> ON <matching criteria> WHERE id = <some number> GROUP BY <criteria> ORDER BY <criteria>"

Now - depending on the selection one of two different queries may need run. So on the subform - I have it linked (control source I believe) to qryData.

What I've been trying to do (and maybe going about it all wrong) is on the onUpdate of the combobox redefine the the actual query to the information required and set the right id number and then requery the form using:

Me.childform.Form.Requery

It goes through everything without error - but the information in my subform doesn't seem to update. If I go to the qeury object itself and open it...it displays the correct information - and when I go into design view (which of course just shows the SQL code) it has the right code. So why doesn't the childform reflect the changE?


 
You may try to replace this:
Me.childform.Form.Requery
By this:
Me.childform.Form.RowSource = "SELECT ...."

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
RowSource doesn't seem to be a vaild object for Childform.Form...

With my above example I know its requerying the data - its just not updating the subform with the new query....
 
Okay - looks like adding a

me.childform.form.refresh after the requery fixes everything....Thanks so much for your help.
 
well - no. I guess I was wrong it didn't fix anything. I can switch my combobox - and nothing will happen in the subform. But if I open the subform alone - it opens with the correct data - so, I guess its all about updating my subform....but I don't know how to achieve that...
 
I just used
Me.BidChild.Form.RecordSource = "SELECT...
Like PHV suggested and it worked. Just needed to use RecordSource not Rowsource and it seems to work great! Thanks for all of your help!
 
=) No worries what so ever! With all the help you've given me since I've started posting here - you've earned the right to have the occassional typo! Thanks for everything!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top