Solved

How to requery a form which is on another form

Posted on 2014-11-10
3
592 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
[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
3 Comments
 
LVL 37

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

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.

Question has a verified solution.

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

Suggested Solutions

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
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…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

740 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