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
LVL 4
mikemAsked:
Who is Participating?
 
DedushkaConnect With a Mentor Commented:
Thank you for accepting my answer.
Have a nice day,
Dedushka
0
 
DedushkaCommented:
Hi mikem.
Try to do this in Subform1 AfterUpdate event:

me!Parent!Subform2.Form.Requiery

Regards,
Dedushka
0
 
mikemAuthor Commented:
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
0
 
mikemAuthor Commented:
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
0
 
JimMorganCommented:
Dedushka:

Er, you forgot to mark you acceptance as an answer.
0
All Courses

From novice to tech pro — start learning today.