Link to home
Start Free TrialLog in
Avatar of Mike Montgomery
Mike MontgomeryFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Requery a Query in a Subform

I have a database with one main form and in it are two sub forms. Sub form 1 updates a separate table. Sub form 2 displays the results of a query based upon the input from subform 1. When the user adds information to the table, I need the query to re-run (or the sub-form 2 to requery) when new data is added to the table. However using Requery [code_to_subform2] nothing appears to happen. I guess I am on the wrong track here ..

any help on this would be appreciated.

Thanks,

Mike
Avatar of Dedushka
Dedushka

Hi mikem.
Try to do this in Subform1 AfterUpdate event:

me!Parent!Subform2.Form.Requiery

Regards,
Dedushka
Avatar of Mike Montgomery

ASKER

Didnt quite work, however it put me on the right track and I have it working now. Thank you... If you re-submit as an answer I will give you the points.

Mike
For info I did the folowing:

DoCmd.GoToRecord , , acNewRec
Forms![MainForm]![SubForm2].Form.Requery

I had to do this through a click_event on a button. First it updates
the table with the new info and goes to a new record, then your code (slightly modified) after this event.

Thanks again

MIke
ASKER CERTIFIED SOLUTION
Avatar of Dedushka
Dedushka

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Dedushka:

Er, you forgot to mark you acceptance as an answer.