A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Query based Report using parameters



 
 
Thread Tools Display Modes
  #1  
Old March 5th, 2007, 05:23 PM posted to microsoft.public.access.reports
mobo
external usenet poster
 
Posts: 3
Default Query based Report using parameters

Hi, I have a query which calculates for every record in the Payments table a
LastIssueDate and a NextOrderDate. This is done using for each of the date
fields the DateAdd function based on a FirstIssueDate. I can produce a report
based on this query but wish to do so by filtering the NextOrderDate with a
user input for Start and End dates. I assume I need some sort of Report run
time parameter based on the query and as a start to solving this problem used
the Between function in the criteria of the NextOrderDate field of the query.
Although the user can input the required dates they have no effect on the
query output. I would appreciate any advice to resolve this issue. Thanks
--
Rob
  #2  
Old March 6th, 2007, 01:06 AM posted to microsoft.public.access.reports
Allen Browne
external usenet poster
 
Posts: 11,706
Default Query based Report using parameters

See:
Limiting a Report to a Date Range
at:
http://allenbrowne.com/casu-08.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"mobo" wrote in message
...
Hi, I have a query which calculates for every record in the Payments table
a
LastIssueDate and a NextOrderDate. This is done using for each of the date
fields the DateAdd function based on a FirstIssueDate. I can produce a
report
based on this query but wish to do so by filtering the NextOrderDate with
a
user input for Start and End dates. I assume I need some sort of Report
run
time parameter based on the query and as a start to solving this problem
used
the Between function in the criteria of the NextOrderDate field of the
query.
Although the user can input the required dates they have no effect on the
query output. I would appreciate any advice to resolve this issue. Thanks
--
Rob


  #3  
Old March 7th, 2007, 08:42 AM posted to microsoft.public.access.reports
mobo
external usenet poster
 
Posts: 3
Default Query based Report using parameters

Thanks very much. Your Method 2 works but I seem to have a #Name problem with
the 2 text boxes inserted into the Report Header which defy the usual reasons
but I can probably resolve. However, while the process works, the Between
part does so providing I know and use Start and End Dates that exist in the
report. Is there a way of changing the coding so that inputting 2 dates which
may or may not exist will return all valid dates in between. Thanks
--
Rob


"Allen Browne" wrote:

See:
Limiting a Report to a Date Range
at:
http://allenbrowne.com/casu-08.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"mobo" wrote in message
...
Hi, I have a query which calculates for every record in the Payments table
a
LastIssueDate and a NextOrderDate. This is done using for each of the date
fields the DateAdd function based on a FirstIssueDate. I can produce a
report
based on this query but wish to do so by filtering the NextOrderDate with
a
user input for Start and End dates. I assume I need some sort of Report
run
time parameter based on the query and as a start to solving this problem
used
the Between function in the criteria of the NextOrderDate field of the
query.
Although the user can input the required dates they have no effect on the
query output. I would appreciate any advice to resolve this issue. Thanks
--
Rob



  #4  
Old March 7th, 2007, 01:26 PM posted to microsoft.public.access.reports
Allen Browne
external usenet poster
 
Posts: 11,706
Default Query based Report using parameters

For Method 1, switch the query to design view.

Change the WHERE clause like this:
WHERE (([StartDate] Is Null) OR ([MyField] = [StartDate))
AND (([EndDate] Is Null) OR ([MyField] [EndDate] + 1))

For Method 2, the code already handles nulls. But make sure the focus is not
still in the last date field, and the value may not have been updated. (If
you clicked the button, then the value of the text box is updated, so that's
not the issue.

Remove the apostrophy from the start of the Debug.Print line, and look in
the Immediate Window (Ctrl+G) to see if the expression looks right.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"mobo" wrote in message
...
Thanks very much. Your Method 2 works but I seem to have a #Name problem
with
the 2 text boxes inserted into the Report Header which defy the usual
reasons
but I can probably resolve. However, while the process works, the Between
part does so providing I know and use Start and End Dates that exist in
the
report. Is there a way of changing the coding so that inputting 2 dates
which
may or may not exist will return all valid dates in between. Thanks
--
Rob


"Allen Browne" wrote:

See:
Limiting a Report to a Date Range
at:
http://allenbrowne.com/casu-08.html

"mobo" wrote in message
...
Hi, I have a query which calculates for every record in the Payments
table
a
LastIssueDate and a NextOrderDate. This is done using for each of the
date
fields the DateAdd function based on a FirstIssueDate. I can produce a
report
based on this query but wish to do so by filtering the NextOrderDate
with
a
user input for Start and End dates. I assume I need some sort of Report
run
time parameter based on the query and as a start to solving this
problem
used
the Between function in the criteria of the NextOrderDate field of the
query.
Although the user can input the required dates they have no effect on
the
query output. I would appreciate any advice to resolve this issue.
Thanks
--
Rob




  #5  
Old March 8th, 2007, 03:24 PM posted to microsoft.public.access.reports
mobo
external usenet poster
 
Posts: 3
Default Query based Report using parameters

Very helpful Allen, problem now resolved and very much appreciate your
assistance.
--
Rob


"Allen Browne" wrote:

For Method 1, switch the query to design view.

Change the WHERE clause like this:
WHERE (([StartDate] Is Null) OR ([MyField] = [StartDate))
AND (([EndDate] Is Null) OR ([MyField] [EndDate] + 1))

For Method 2, the code already handles nulls. But make sure the focus is not
still in the last date field, and the value may not have been updated. (If
you clicked the button, then the value of the text box is updated, so that's
not the issue.

Remove the apostrophy from the start of the Debug.Print line, and look in
the Immediate Window (Ctrl+G) to see if the expression looks right.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"mobo" wrote in message
...
Thanks very much. Your Method 2 works but I seem to have a #Name problem
with
the 2 text boxes inserted into the Report Header which defy the usual
reasons
but I can probably resolve. However, while the process works, the Between
part does so providing I know and use Start and End Dates that exist in
the
report. Is there a way of changing the coding so that inputting 2 dates
which
may or may not exist will return all valid dates in between. Thanks
--
Rob


"Allen Browne" wrote:

See:
Limiting a Report to a Date Range
at:
http://allenbrowne.com/casu-08.html

"mobo" wrote in message
...
Hi, I have a query which calculates for every record in the Payments
table
a
LastIssueDate and a NextOrderDate. This is done using for each of the
date
fields the DateAdd function based on a FirstIssueDate. I can produce a
report
based on this query but wish to do so by filtering the NextOrderDate
with
a
user input for Start and End dates. I assume I need some sort of Report
run
time parameter based on the query and as a start to solving this
problem
used
the Between function in the criteria of the NextOrderDate field of the
query.
Although the user can input the required dates they have no effect on
the
query output. I would appreciate any advice to resolve this issue.
Thanks
--
Rob




 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:42 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.