Solved

User requests ignored after Requery of parent form.

Posted on 2007-04-05
7
265 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

 

Author Comment

by:jlwhite1
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
happy to help!
J
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
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…

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now