Parameter Passing

  • Thread starter Thread starter Mac
  • Start date Start date
M

Mac

Dear All,

I have to pass a variable to a report that is not entered by the user,
it's a two part variable, basically a between a and b where a is a
subquery and b is a user entered date. I can get the relevant text box
on my form to pick up the user entered variable, but the moment I try
to get it to pick up the subquery variable I get the name? error. The
text box should ideally end up looking like "Period : 01/01/06 to
30/06/06", where the 01/01/06 comes from the subquery and the 30/06/06
from the user. I've tried using a front end form to no avail, so any
suggestions gratefully recieved. TIA.

Mac
 
What do you mean by "pick up the subquery?" Subqueries only exist in SQL
statements, so you couldn't "pick one up," AFAIK. Help us with some
information and maybe someone can assist.

If you are using code, post it; if you are trying to use a Query in the
ControlSource, that will not work, but a Domain Aggregate Function, such as
DLookup might work for you in the ControlSource.

Larry Linson
Microsoft Access MVP
 
Dear Larry,

What I mean by pickup the subquery, is that the result of the subquery
(in my example above 01/06/06) be carried into the end result of the
text box, not the subquery itself. I was just wondering if that can be
done?

Regards

Mac
 
I am confused by what you mean by "subquery." The definition of "subquery"
with which I am familiar is an SQL statement that is embedded in another SQL
statement. Perhaps it is just a matter of terminology, but I don't see how
that fits with your use of the term.

And, "_the_ subquery" is even more confusing, because most Access objects do
not use a Query containing a Subquery (or the corresponding SQL).

Ross Perot, when running for President, said, "The Devil's in the details."
That applies to questions about databases, too.

Larry Linson
Microsoft Access MVP
 
Dear Larry,

Sorry for not getting back to you sooner, been tied up with other
aspects of the database. It's possible I'm using the term subquery
inappropriately, what I was trying to do was run a report with a text
box that displayed a date range Eg: "1st February 2006 to 31 July
2006". The later date is simply a requestor that a user then puts a
date into and it is then formatted in the text box this is part of the
criteria for the underlying query. The first part has to be drawn from
an existing value in a connected but not directly related table. As
there are multiple criteria I was hoping to use a query ((SELECT
Max(PytDate.RecordedDate) AS MaxOfRecordedDate FROM PytDate GROUP BY
PytDate.RecordedDateID HAVING (((PytDate.RecordedDateID)="LSD"));) The
resulting criteria is . (Between (SELECT Max(PytDate.RecordedDate) AS
MaxOfRecordedDate FROM PytDate GROUP BY PytDate.RecordedDateID HAVING
(((PytDate.RecordedDateID)="LSD")); And [Please Enter End Date]).
Ideally what I would like is for both dates to appear in the text box.
Can this be done?

TIA

Andy
 
Back
Top