Solved

User requests ignored after Requery of parent form.

Posted on 2007-04-05
7
309 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

724 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