Solved

Passing subform values to a parameter query

Posted on 2004-10-01
2
214 Views
Last Modified: 2008-02-20
I have a subform that passes two dates into a criteria expression in my query. I keep getting prompted for parameter entries for both dates.

These are the forms I'm using...

frmReports: is the main form
frmSubReports: is the name of the subform control on the main form
frmSubReportsDates: is the name of the subform that is called and appears in the the subform control
ctrFromDate and ctrToDate: the names of the DTPicker controls contained in frmSubReportsDates

Originally, I was testing with just the subform and everything seemed ok.

I used this...

Between [Forms]![frmSubReportsDates].[ctrFromDate] And [Forms]![frmSubReportsDates].[ctrToDate]

Once I opened up the main form containing the subform then I started to receive the prompts asking to enter parameter values.

I have since modified the query expession to this...

Between [forms]![frmReports].[frmSubFormReports].[Form]![frmSubReportsDates].[ctrFromDate] And [forms]![frmReports].[frmSubFormReports].[Form]![frmSubReportsDates].[ctrToDate]

This is where I'm stuck. Any suggestions?

0
Comment
Question by:JakeB52
2 Comments
 
LVL 39

Accepted Solution

by:
stevbe earned 50 total points
ID: 12202075
[forms]![frmReports].[frmSubFormReports].[Form]![frmSubReportsDates].[ctrFromDate]

you need to use the name of the subform control and not the name of the embedded form

[Forms]![frmReports].[childReports].[Form].[childDates].[Form].[ctrFromDate]

check the . and ! s

Steve
0
 

Author Comment

by:JakeB52
ID: 12297527
Oops! I forgot to follow up on this thread.

Steve, your suggestion pointed me in the right direction.

The final solution was as follows:

Between [Forms]![frmReports]![ChildReports].[Form]![ctrFromDate] And [Forms]![frmReports]![ChildReports].[Form]![ctrToDate]

Thanks for your help.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

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…
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…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

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

19 Experts available now in Live!

Get 1:1 Help Now