Solved

How to requery a form which is on another form

Posted on 2014-11-10
3
445 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

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

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server stored procedures 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 Micr…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

706 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

20 Experts available now in Live!

Get 1:1 Help Now