PC Review


Reply
Thread Tools Rate Thread

criteria data in report

 
 
pht1991
Guest
Posts: n/a
 
      14th Jan 2008
I pull a report from a query. When I do so, I am prompted for date
parameters (part of the query). I would like the values that I enter for
these parameters to show up on the report. Any suggestions?

Thanks
 
Reply With Quote
 
 
 
 
Dirk Goldgar
Guest
Posts: n/a
 
      14th Jan 2008
"pht1991" <(E-Mail Removed)> wrote in message
news:62EFE5CF-1D2B-4572-BEE8-(E-Mail Removed)...
>I pull a report from a query. When I do so, I am prompted for date
> parameters (part of the query). I would like the values that I enter for
> these parameters to show up on the report. Any suggestions?



You can get the parameters into the query as calculated fields. Here's an
example:

SELECT
MyTable.*,
[Enter Start Date] As FromDate,
[Enter End Date] As ToDate,
FROM MyTable
WHERE
MyTable.DateField Between [Enter Start Date] And [Enter End Date]

Having set up the query that way, the parameter values will be available as
fields FromDate and ToDate, and you can include those fields on your report.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

 
Reply With Quote
 
pht1991
Guest
Posts: n/a
 
      14th Jan 2008
Sorry -I'm a novice. So you are saying that I need to write a formula in the
Criteria section of the query?

I don't understand the formula. The table name I want to use is "transcript
orders". The field I want to criteria on is simply "Date"

Are SELECT, FROM and WHERE commands that I need in the formula?

What is "MyTable.*,"?

The more you can break it down for me, the better - me knowledge is very
limmited.

Thanks,
LE

"Dirk Goldgar" wrote:

> "pht1991" <(E-Mail Removed)> wrote in message
> news:62EFE5CF-1D2B-4572-BEE8-(E-Mail Removed)...
> >I pull a report from a query. When I do so, I am prompted for date
> > parameters (part of the query). I would like the values that I enter for
> > these parameters to show up on the report. Any suggestions?

>
>
> You can get the parameters into the query as calculated fields. Here's an
> example:
>
> SELECT
> MyTable.*,
> [Enter Start Date] As FromDate,
> [Enter End Date] As ToDate,
> FROM MyTable
> WHERE
> MyTable.DateField Between [Enter Start Date] And [Enter End Date]
>
> Having set up the query that way, the parameter values will be available as
> fields FromDate and ToDate, and you can include those fields on your report.
>
> --
> Dirk Goldgar, MS Access MVP
> www.datagnostics.com
>
> (please reply to the newsgroup)
>

 
Reply With Quote
 
John W. Vinson
Guest
Posts: n/a
 
      14th Jan 2008
On Sun, 13 Jan 2008 20:10:01 -0800, pht1991
<(E-Mail Removed)> wrote:

>Sorry -I'm a novice. So you are saying that I need to write a formula in the
>Criteria section of the query?
>
>I don't understand the formula. The table name I want to use is "transcript
>orders". The field I want to criteria on is simply "Date"
>
>Are SELECT, FROM and WHERE commands that I need in the formula?
>
>What is "MyTable.*,"?
>
>The more you can break it down for me, the better - me knowledge is very
>limmited.
>
>Thanks,
>LE
>
>"Dirk Goldgar" wrote:
>
>> "pht1991" <(E-Mail Removed)> wrote in message
>> news:62EFE5CF-1D2B-4572-BEE8-(E-Mail Removed)...
>> >I pull a report from a query. When I do so, I am prompted for date
>> > parameters (part of the query). I would like the values that I enter for
>> > these parameters to show up on the report. Any suggestions?

>>
>>
>> You can get the parameters into the query as calculated fields. Here's an
>> example:
>>
>> SELECT
>> MyTable.*,
>> [Enter Start Date] As FromDate,
>> [Enter End Date] As ToDate,
>> FROM MyTable
>> WHERE
>> MyTable.DateField Between [Enter Start Date] And [Enter End Date]


The query grid is simply a tool to construct a SQL string. Dirk - not knowing
anything about your tablenames or fieldnames - has offered you a SQL string.

What you can do to get the same result is open your query in design grid view.
Copy and paste the prompts from your Critera line into vacant Field cells in
the top row of the query. Or, select View... SQL; you'll see something
resembling what Dirk posted, with your actual table names, fieldnames and
prompts. You can copy the Between... And... prompts into the SELECT clause
following his example.

John W. Vinson [MVP]
 
Reply With Quote
 
Dirk Goldgar
Guest
Posts: n/a
 
      14th Jan 2008
"pht1991" <(E-Mail Removed)> wrote in message
news:E0E65B4B-EB03-41C2-A6BF-(E-Mail Removed)...
> Sorry -I'm a novice. So you are saying that I need to write a formula in
> the
> Criteria section of the query?


No. I was suggesting that you define calculated fields in your query that
would hold the parameters.

> I don't understand the formula. The table name I want to use is
> "transcript
> orders". The field I want to criteria on is simply "Date"


Just for future reference, "Date" is a bad name to use for a field. There's
a built-in function named "Date" and having that as a field name can lead to
problems unless you handle it just right. I suppose it's too late to rename
that field? We can work around it if we have to.

> Are SELECT, FROM and WHERE commands that I need in the formula?


No. Those are elements of the SQL statement. It's not a formula, it's the
"SQL View" of a query. What I posted was an example.

> What is "MyTable.*,"?


"MyTable" was just the name of the table I used for my example. "SELECT
MyTable.*", in SQL, means "select all the fields in the table named
'MyTable'".

> The more you can break it down for me, the better - me knowledge is very
> limmited.


I think we'd better approach this from a different angle. You say your
report is based on a query that has date parameters. Please open that query
in SQL View, and copy/paste the SQL statement into a reply to this message.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

 
Reply With Quote
 
pht1991
Guest
Posts: n/a
 
      14th Jan 2008


"Dirk Goldgar" wrote:

> "pht1991" <(E-Mail Removed)> wrote in message
> news:E0E65B4B-EB03-41C2-A6BF-(E-Mail Removed)...
> > Sorry -I'm a novice. So you are saying that I need to write a formula in
> > the
> > Criteria section of the query?

>
> No. I was suggesting that you define calculated fields in your query that
> would hold the parameters.
>
> > I don't understand the formula. The table name I want to use is
> > "transcript
> > orders". The field I want to criteria on is simply "Date"

>
> Just for future reference, "Date" is a bad name to use for a field. There's
> a built-in function named "Date" and having that as a field name can lead to
> problems unless you handle it just right. I suppose it's too late to rename
> that field? We can work around it if we have to.
>
> > Are SELECT, FROM and WHERE commands that I need in the formula?

>
> No. Those are elements of the SQL statement. It's not a formula, it's the
> "SQL View" of a query. What I posted was an example.
>
> > What is "MyTable.*,"?

>
> "MyTable" was just the name of the table I used for my example. "SELECT
> MyTable.*", in SQL, means "select all the fields in the table named
> 'MyTable'".
>
> > The more you can break it down for me, the better - me knowledge is very
> > limmited.

>
> I think we'd better approach this from a different angle. You say your
> report is based on a query that has date parameters. Please open that query
> in SQL View, and copy/paste the SQL statement into a reply to this message.
>
> --
> Dirk Goldgar, MS Access MVP
> www.datagnostics.com
>
> (please reply to the newsgroup)


Dirk - someone else suggested that I past the prompts into blank fields in
the query. This seems to have worked just fine. THanks for the help!
 
Reply With Quote
 
Dirk Goldgar
Guest
Posts: n/a
 
      14th Jan 2008
"pht1991" <(E-Mail Removed)> wrote in message
news:C80A20B1-D9FD-47DB-A571-(E-Mail Removed)...
>
> Dirk - someone else suggested that I past the prompts into blank fields in
> the query.


Yes, that's the visual equivalent of what I was trying to get at via SQL.
I'm glad you got it working.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

 
Reply With Quote
 
Dirk Goldgar
Guest
Posts: n/a
 
      14th Jan 2008
"John W. Vinson" <jvinson@STOP_SPAM.WysardOfInfo.com> wrote in message
news:(E-Mail Removed)...

<a clearer explanation than I was able to manage>

Thanks, John.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Add additional data to a report based on specific criteria JSprawls Microsoft Access Reports 1 1st Feb 2009 03:22 AM
Create Report By Data Criteria =?Utf-8?B?RGF2ZV9GRk0=?= Microsoft Access Reports 6 23rd Aug 2007 03:56 PM
data type mismatch in report criteria expression =?Utf-8?B?Q0FN?= Microsoft Access Reports 4 11th Jan 2006 11:39 PM
Show or hide data in a report based on certain criteria or condition Ed Dobbin Microsoft Access Reports 3 2nd May 2004 08:54 PM
pulling data from search criteria into a report Joyce Microsoft Access Reports 0 12th Jan 2004 10:12 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:37 AM.