Access Chart tool Doubt

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rwalle
    New Member
    • Jan 2010
    • 47

    Access Chart tool Doubt

    I have developed a line chart inside a report to display some data, it takes data from a query that has a WHERE parameter to define date I want to view, I ´d like to set this date parameter not filling the parameter pop up but from a form text box with the date picker, I have used this method for several reports using the WHERE clause and it worked but since the report containig the chart doesn't have any data but the chart, I dont know how to handle it,
    are there somebody have dealed with this

    Thanks in advance for your help

    R Walle
  • nico5038
    Recognized Expert Specialist
    • Nov 2006
    • 3080

    #2
    Just create a (dummy) table with one row and bind the report to that table.

    Nic;o)

    Comment

    • rwalle
      New Member
      • Jan 2010
      • 47

      #3
      Nico TKS for your response,
      actually the report containing the chart works, it opens but since I take off the WHERE parameter in the query design view the chart display all the data without filtering, I´d like to use a text field on a form with the date picker so the DB user can pick a date and then clicking a button run a macro with a WHERE clause based on the form date picker value, that opens the chart report and shows only data limited by the WHERE clause

      Comment

      • TheSmileyCoder
        Recognized Expert Moderator Top Contributor
        • Dec 2009
        • 2322

        #4
        You can dynamically set the SQL of the chart using VBA code. Whether its possible by using standards macro's I have no clue.

        Code:
        ctrlChart.RowSource = strSQL
        Thats for a chart in the control named ctrlChart, where strSQL is a string containing the SQL statement.

        What I did when I started trying to dynamically manipulate charts in Access reports was to open up a similar graph chart in excel, start the macro recorder, record my changes (Like setting X-axes or line width), end the recorder, and look at the code. Its not always 100% copy-pastable into Access but its a quite descent starting point.

        Comment

        • nico5038
          Recognized Expert Specialist
          • Nov 2006
          • 3080

          #5
          I´d like to use a text field on a form with the date picker so the DB user can pick a date
          An alternative is to use the form field in the query's WHERE clause.
          This will look like: Forms("formname ")!fieldnam e

          Personally I often use a user defined public variable and a function like:
          Code:
          Public dtChart as date
          
          Function fncChartDate()
             fncChartDate = dtChart
          END Function
          Now you can fill the date when the button is pressed with:
          dtChart = Me.Chartdate
          and use in the query for the WHERE clause just the function like:
          Code:
          select * from tblX where ChartDate = fncChartDate()
          Nic;o)

          Comment

          • rwalle
            New Member
            • Jan 2010
            • 47

            #6
            Tks All for your quickly response,
            Happily, I can say it worked, I used the Nico sugestion and change the [<parameter>] for [forms]![<SearchForm>]![<DateField>] in the SQL WHERE clause and it worked
            my problem was that I tried to made this changes in the chart data properties and at the end I realized I had a query where the chart's report is tied to so I set this WHERE condition on that query and now is working

            Tks again and see next doubt

            Raymundo Walle

            Comment

            Working...