[AccessD] Prompt for input on report with chart

Joe Rojas JRojas at tnco-inc.com
Thu May 12 07:42:48 CDT 2005


Thanks for the replay Stuart!

I just had couple of questions.

Is this correct?
WHERE [DateOpened] BETWEEN StartDate() AND EndDate()#5/1/2005# AND
#5/7/2005#

or did you mean

WHERE [DateOpened] BETWEEN StartDate() AND EndDate()

Also I did not recognize this syntax:

StartDate() txtStartDate
EndDate() txtEndDate

Is this correct?

Thanks!
JR
-----Original Message-----
From: Stuart McLachlan [mailto:stuart at lexacorp.com.pg]
Sent: Wednesday, May 11, 2005 6:11 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Prompt for input on report with chart

On 11 May 2005 at 9:08, Joe Rojas wrote:

> I have a report that only has a bar graph chart on it.
> What I am trying to do is have the user prompted for a date range that
will
> be used to qualify what records are returned.
> I thought that if I change the two dates in the qReportData (see below) to
> something like [Enter Start Date] and [Enter End Date] that this would
give
> me what I was looking for but instead I get an error message that reads:
> "The Microsoft Jet database engine does not recognize '[Enter Start Date]'
> as a valid field name or expression"
>

You can't use paramaters in this situation. A common solution is to use
static functions.  Here's how to do it using funcitons StartDate() and
ENdDate():

Have a "Report Selection Form" whith two text boxes (txtStartDate and
txtEndDate) and buttons to print/preview your reports.

In each button's on_click use

StartDate() txtStartDate
EndDate() txtEndDate
DoCmd.OPenReport.......

In your query, use
WHERE [DateOpened] BETWEEN StartDate() AND EndDate()#5/1/2005# AND
#5/7/2005#

Place these two functions in a module:

Static Function StartDate(Optional strInput As String) As Date
    Dim dteStore As Date
    If strInput > " " Then dteStore = DateValue(strInput)
    StartDate = dteStore
End Function

Static Function EndDate(Optional strInput As String) As Date
    Dim dteStore As Date
    If strInput > " " Then dteStore = DateValue(strInput)
    EndDate = dteStore
End Function

--
Stuart


--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



This electronic transmission is strictly confidential to TNCO, Inc. and
intended solely for the addressee. It may contain information which is
covered by legal, professional, or other privileges. If you are not the
intended addressee, or someone authorized by the intended addressee to
receive transmissions on behalf of the addressee, you must not retain,
disclose in any form, copy, or take any action in reliance on this
transmission. If you have received this transmission in error, please notify
the sender as soon as possible and destroy this message. While TNCO, Inc.
uses virus protection, the recipient should check this email and any
attachments for the presence of viruses. TNCO, Inc. accepts no liability for
any damage caused by any virus transmitted by this email.



More information about the AccessD mailing list