Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Jun 2002
    Location
    RTP, NC, USA
    Posts
    40
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Date field in graph (A97)

    I have a pie graph in my db that is based on a Select statement in the Row Source property (as opposed to the report itself being based on a query from the Record Source property). In my query I have a [Between] statement that propmts the user for a date range. I'd like this date range to be displayed on the top of the graph once the user enters it...but I can't figure out how to get the report to do that. Any ideas will be much appreciated...

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Date field in graph (A97)

    Create a form with two text boxes txtStartDate and txtEndDate, and a command button cmdOK. Say that this form is saved as frmDateRange.

    Open the query that acts as row source of the chart in design view. Change the criteria for the date field to

    Between [Forms]![frmDateRange]![txtStartDate] And [Forms]![frmDateRange]![txtEndDate]

    Put two text boxes on the report, with control source =[Forms]![frmDateRange]![txtStartDate] and =[Forms]![frmDateRange]![txtEndDate] respectively, Or put one wide text box on the report, with control source

    ="Date range from " & Format([Forms]![frmDateRange]![txtStartDate],"mm/dd/yy") & " to " & Format([Forms]![frmDateRange]![txtEndDate],"mm/dd/yy")

    You can use another format string, of course, and other bits of text.

    Use the On Click event of the command button on the form to open the report:

    Private Sub cmdOK_Click
    DoCmd.OpenReport "rptWhatever", acViewPreview
    End Sub

  3. #3
    Lounger
    Join Date
    Jun 2002
    Location
    RTP, NC, USA
    Posts
    40
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Date field in graph (A97)

    Works like a charm, Hans....Thanks!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •