Solved

User requests ignored after Requery of parent form.

Posted on 2007-04-05
7
290 Views
Last Modified: 2013-11-28
I am attempting to write VB code in Access to requery a parent form after updating a subform.  So far I can requery the parent form and return to the original record,(using Bookmark) but any action, such as clicking on a Next or Previous button on the parent form (which caused the subform to be updated in the first place) is ignored and the user has to click on the action button again.  Is there a way to force Access to continue on with the original request?
0
Comment
Question by:jlwhite1
  • 4
  • 3
7 Comments
 
LVL 34

Expert Comment

by:jefftwilley
ID: 18862434
you've described some elements in your question...that we're SURE are clear as a bell to you....but don't make sense to us. We don't know what your Action Button is, we don't know what you're trying to accomplish. Is there a specific control on the main form that requires updating after you change something in your subform? Usually that is the other way around...so can you expound some...so we can help you?
0
 

Author Comment

by:jlwhite1
ID: 18862490
Ah, you mean you are not mindreaders? !   I am requerying a parent form's recordsource after the update of a subform.  When the user makes a change to the subform, which has only one field, he normally will click on something in the main form which will take him to the next record or he might select another subform on the same record or another action that moves away from the originl subform.  That triggers the requery action for the parent form.  Even though I can get back to the original record after the requery, whatever the user wanted to do (move to the next record on the parent form, etc.) is lost. Is there a way to get Access to continue on with the user's original request after the requery and return to the original record have happened?
0
 
LVL 34

Expert Comment

by:jefftwilley
ID: 18863031
ok, not to take anything away from your method, but why are you requerying the main form and from what event on your subform. Are you updating something in your subform, that affects a total, or a control on your main form? My thought here is that you can requery just that object, and not the entire main form.
We do try to read minds, but often it's easier to examine method. I understand your problem, and a quick answer is sure...with some pretty nifty coding, and of course...speaking of reading minds...we'd have to be able to guess what button your user is going to push as his next action.
0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

Author Comment

by:jlwhite1
ID: 18863365
I'm requerying the parent form because one of the fields on the parent form is a concantonated field consisting of, of course, the entries on the subform (long story - wish it didn't have to be that way).  I've tried requerying just the field on the parent form, but because the original field has to be deleted and re-added, that field shows #deleted# even after a field requery.  We don't know what the user is going to do on his next action, it could be one of many.  Maybe my only choice is to put a 'requery' button on the subform and train users to click on it; make it the next in the tab sequence so it's easy.
0
 
LVL 34

Accepted Solution

by:
jefftwilley earned 400 total points
ID: 18863570
how about this....instead of requerying the main form when you leave the subform, you calculate the control on the main form.

The change made in the subform is only committed once the user either hits a save button...or leaves the record. So if the focus is on the subform, then you're actually using the fact that you're leaving the form, to commit the record. Problem with that is the value for your main form's control may or may not "find" that last change.

so...

on your subform after_update event

me.dirty = false
me.parent.control = (your formula here)
me.parent.refresh

give that a shot.
0
 

Author Comment

by:jlwhite1
ID: 18864345
Well, that wouldn't exactly work, but it sent me down the right track.  I was deleting the field when all I needed to do was update it on the form.  I reworked the code and all is workng as planned now!. Thanks for setting me straight!
0
 
LVL 34

Expert Comment

by:jefftwilley
ID: 18864382
happy to help!
J
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question