Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 15th, 2004, 01:22 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default Input in Access Report

How can input in the Access Report that it display report
base on two input (dates) ?

I want to give two input in textbox (assign start date) and assign end date) it display records between these dates ?

first input assign start date 03/01/2004 (m/d/y)
second input assign end date 03/31/2004 (m/d/y)

assign start date field is astrdate
assign end date field is aenddate
in the table


after click command button it display records (retrieve all records which are between assgin start date and assign end date).

how can use following query in Access Report ?


SELECT employees.empno, employees.name, approvals.contractno, assignments.aposit, assignments.acontract, assignments.astrdate, assignments.aenddate
FROM (employees INNER JOIN approvals ON employees.empno=approvals.empno) INNER JOIN assignments ON employees.empno=assignments.empno
where assignments.aenddate between '03/01/2004' and '03/31/2004'


Please help, guide the steps how can input the two date
in the Access Report it display report base on these two
input dates ?

Regards.

Mateen





 
Old April 15th, 2004, 09:33 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Well, you can do one of two things. Try substituting the single quotes (') in your query to pound signs (#). The single quote deliminates text, the pound sign deliminates dates.

where assignments.aenddate between #03/01/2004# and #03/31/2004#

Or you can put this on your form's command button that opens the report.

DoCmd.OpenReport "Your Report", acViewPreview, , _
"[aenddate] >= #" & Me.astrdate & "# And [aenddate] <= #" & _
Me.aenddate & "#"


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old April 15th, 2004, 12:02 PM
Authorized User
 
Join Date: Feb 2004
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Curiously the text delimited dates seem to work in many queries. Date/Time fields are stored as doubles and using text delimiters imposes an implicit type conversion to string. This may result in the loss of use of any indexing on the date field resulting in less than optimal performance. For this reason, it is wise to follow Greg's suggestion regarding the delimiters.

An alternative to using a filter in the OpenReport paramters as suggested is that you may also set the SQL property of a saved querydef used as the report recordsource. The downside of this approach is that query compilation will be lost and the changing of saved objects results in a small amount of file bloat (recovered on compacting). The upside of loss of query compilation is that DAO queries frequently run faster where the query is changed to restrictive where conditions because the compiled plan is no longer appropriate. If performance becomes an issue as the database grows, you may wish to investigate further.

If you have subreports not directly contingent on linking fields, setting the SQL property of a saved querydef for the subreports may be the only solution.

You may wish to consider the use of paramaterized queries. This is an area I plan to investigate in greater detail in the near future.

Ciao
Jürgen Welz
Edmonton AB Canada
[email protected]
 
Old April 17th, 2004, 03:31 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thank you very much for your help.

first option is working.
but in the second option, I try

Dim stDocName As String

    stDocName = "Supervsion Staff Assignment(input4)"
    DoCmd.OpenReport stDocName, acPreview, , _
    "[aenddate] >= #" & Me.astrdate & "# And [aenddate] <= #" & _
    Me.aenddate & "#"

it give error message that
"compile error, Method or date member not found"

you like to explain what is the method or date member in the error?

main problem is solve.

Mateen






Quote:
quote:Originally posted by SerranoG
 Well, you can do one of two things. Try substituting the single quotes (') in your query to pound signs (#). The single quote deliminates text, the pound sign deliminates dates.

where assignments.aenddate between #03/01/2004# and #03/31/2004#

Or you can put this on your form's command button that opens the report.

DoCmd.OpenReport "Your Report", acViewPreview, , _
"[aenddate] >= #" & Me.astrdate & "# And [aenddate] <= #" & _
Me.aenddate & "#"


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old April 19th, 2004, 06:58 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

In means either one of two things. Either the variable AENDDATE doesn't exist in your report "Supervsion Staff Assignment(input4)", or one/both of the textboxes (Me.astrdate/Me.aenddate) doesn't/don't exist on your form.

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old April 20th, 2004, 04:51 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks.


Quote:
quote:Originally posted by SerranoG
 In means either one of two things. Either the variable AENDDATE doesn't exist in your report "Supervsion Staff Assignment(input4)", or one/both of the textboxes (Me.astrdate/Me.aenddate) doesn't/don't exist on your form.

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division





Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing input Dates in a Crystal Report from ASP P preethig Classic ASP Basics 4 March 5th, 2008 08:50 AM
Form Input, Parameters, Report Based on Query DavidWE Access VBA 2 November 6th, 2006 10:36 AM
Input data from file to report in .net krisXp Crystal Reports 0 May 4th, 2006 07:13 AM
Creating a report receiving input on range Jnaylor28 Access VBA 1 July 12th, 2005 11:54 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.