?
Solved

requery macro command for a form with 2 subforms

Posted on 2002-05-29
7
Medium Priority
?
526 Views
Last Modified: 2012-06-27
Question relates to a database for tracking the "time used" for gages in a factory. I have a main form called "Gage" with a subform "Issues" and a second subform "Usage". Issues' data source is a table that tracks when a gage is issued out for use, and when it returns (field names are DateOut and DateReturned). The Usage subform's data source is a query that calculates the total elapsed time that the gage has been issued. When the DateReturned field (on Issues subform)is modified, I want it to trigger a recalculation of the fields on the Usage subform. I have been trying to use the requery macro without success - the error message is something to the effect... "You can't use the ApplyFilter action on this window...". I have tried a variety of object names for the requery, but none have worked. I am using Access 2000. Thanks for any suggestions.

- Lennygw
0
Comment
Question by:lennygw
[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
7 Comments
 
LVL 12

Expert Comment

by:James Elliott
ID: 7042965
Put this on the after update event on your DateReturned Field.

docmd.requery([Control Name])

where control name is the reference to the control on your usage form.

Is that what you are looking for?

Thanks

Jell
0
 

Author Comment

by:lennygw
ID: 7043072
Jell -
Thanks for your response and to answer your question, well yes and no - yes this is the idea, but I can't get it to work. I think the key may lie in the syntax of the control that I'm trying to requery. Remember, when entering the "DateReturned", the focus is in the Issues subform, and I'm trying to get it to trigger a requery of the other subform (sfrmUsage). The syntax: 'forms!gages!sfrmUsage.form!DaysUsed' doesn't work and neither does any other that I've tried. I either get an error that it can't find the field or "You can't use the ApplyFilter action on this window". I think I need the proper syntax to refer to the other subform or perhaps an altogether different solution to update the "usage". Again, any suggestions are appreciated.

- Lennygw
0
 
LVL 1

Expert Comment

by:dynamictiger
ID: 7043117
I think you need to set the focus into the main form first, then requery the subform, using Me.
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 3

Accepted Solution

by:
MCummings111400 earned 400 total points
ID: 7043515
Try this

Me.Parent.sfrmUsage.Form.DaysUsed.Requery
0
 

Expert Comment

by:Oxman39
ID: 7043569
Lennygw,
You shouldn't have to set the focus to the main form to requery a sub form from another event on a separate subform.  If you right click in your code module, select the "List Properties/Methods" option.  Now just scroll down until you see the name of your main form.  Hit the period button and select the subform name.  HIt the period and scroll to Requery.  That should do it.
0
 

Author Comment

by:lennygw
ID: 7044318
Oxman39,
Thanks for the suggestion. I like the propect of not having to change focus to the main form and I gave it a try - unfortunately, the "List Properties/Methods" did not include the parent form. In fact it only listed 4 of the 12 forms currently in the database.
0
 

Author Comment

by:lennygw
ID: 7044329
Yes - it worked great. Actually, I shortened it up to requery the whole parent form which recalcs the usage subform - me.parent.requery - Thanks!
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Suggested Courses

764 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