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

Access 2007 subform requery 3

Status
Not open for further replies.

mikesmithblue

Technical User
Sep 30, 2010
2
US
I have fried my eyes searching and while I have found many close, have not been able to find exact issue (maybe I missed it, if so I apologize)

I have a main form “FrmProcessMain” which updates “TblProcessMain” and a subform “QryEstSubForm”. The subform is a combination of two queries which pull from the same main table “TblProcessMain”

Here is what I am trying to do. Once I enter and/or change data on the main form (in a field that the queries pull from) I would like the subform to then “automatically” update. The best I have gotten is I can get it to update but I have to click on/in the subform. I really want to avoid having to do that. The idea is the user just has to enter in his data and then the subform will instantly display the result/answer so to speak.

Any help/comments/suggestions greatly appreciated. In my feable mind this should be easy but apparently not for me.
Thanks
 
Updating a bound control in the main form will not save the record in the main form until you either leave the form or force a save with code like:
Code:
  Me.Dirty = True
You could put this in a function in the form's module and call it from the After Update event property of each bound control. You could also add a line of code to requery your subform.

Duane
Hook'D on Access
MS Access MVP
 
I think Duane meant this:
Me.Dirty = [!]False[/!]
 
How are ya mikesmithblue . . .

In the [blue]After Update[/blue] event of the control that the queries pull from, copy/paste the following:
Code:
[blue]   If Me.Dirty Then Me.Dirty = False
   [QryEstSubForm].Form.Requery[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
To each of you thank you very much.

I swear I tried that before.......but obviously not, because as soon as I used ACE's code...presto. As I am typing this I am thinking possibly I must have been trying in the past to tie the code to the entire form (properties of table, after update) instead of the individual controls (though I did try the dirty and the requery on a couple controls, but never together).

Regardless I got it now….several hours wasted on my end trying to figure this out some of which was while watching my Dolphins squander away yet another game to the Jets (a double waste of time)

Anyway thank you again for your responses and how quickly you did. I have NEVER “posted” anything and was only giving it about a 50% chance of getting any response
Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top