Solved

How to requery a form which is on another form

Posted on 2014-11-10
3
475 Views
Last Modified: 2014-11-10
I have a form on which I set a range of criteria and I have three queries which use those criteria to select three sets of data from a table named tblTasks. I created three forms based on these three queries and added them to the main selection form.
I added a "Update Results" control to the main form.
My problem is now to program the "Update Results" control to update the three embedded forms on the main form.

The main form is "frmTasksSelect"
The other three forms are frmTasksInArrears, frmTasksForToday and frmTasksForFuture (They are copies of each other, but are based on different queries.) The queries gives the correct results.

One way that I tried was:

Forms![frmTasksSelect]![frmTasksInArrears].Requery
Forms![frmTasksSelect]![frmTasksForToday].Requery
Forms![frmTasksSelect]![frmTasksForFuture].Requery

Open in new window



I keep on getting error messages like "can't find the field 'frmTasksInArrears' referred to in your expression.
However the second line does not give that error.

I have checked the names over and over.

When I open the forms seperately they work fine. I just can't get them to update (requery) while they are embedded on the main form.

Can you see any problem?
0
Comment
Question by:Fritz Paul
3 Comments
 
LVL 34

Expert Comment

by:PatHartman
ID: 40432932
Include the .Form property in the reference.
Forms![frmTasksSelect].Form![frmTasksInArrears].Requery
Forms![frmTasksSelect].Form![frmTasksForToday].Requery
Forms![frmTasksSelect].Form![frmTasksForFuture].Requery

Open in new window

0
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 40432939
Also be sure that you've got the names of the Subform CONTROLS correct. Depending on how you embed the form, Access will name the Subform Control differently.

If you drag a Subform control to the form, and then set the SourceObject in the designer, then Access will name it something like "SubformControl1".

If you drag/drop a form onto another form, Access will add the Subform Control, and will generally name it to match the name of the Form being used as a Subform.
0
 

Author Closing Comment

by:Fritz Paul
ID: 40432992
Scott thanks, the "source object" was correct, but it was the "Name" that was skew. Thanks for the advice. I wasted so much time on this issue. I did check the "source object", but did not consider the Name.
I love EE.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
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…
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…

867 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

25 Experts available now in Live!

Get 1:1 Help Now