Link to home
Start Free TrialLog in
Avatar of Bevos
Bevos

asked on

Modifying a chart in Access (Changing X axis formatting from SQL statement)

Hello, I have a chart which is being generated by the following SQL code:

Query:
SELECT Imported.[Modified By], Count(1) AS UserCount, (Select Count (*) from Imported) AS TotCount, Round([Usercount]*100/[TotCount],2) AS Userpercent, Sum(IIf([Date Modified]=Date()-14,1,0)) AS Day14, Sum(IIf([Date Modified]=Date()-13,1,0)) AS Day13, Sum(IIf([Date Modified]=Date()-12,1,0)) AS Day12, Sum(IIf([Date Modified]=Date()-11,1,0)) AS Day11, Sum(IIf([Date Modified]=Date()-10,1,0)) AS Day10, Sum(IIf([Date Modified]=Date()-9,1,0)) AS Day9, Sum(IIf([Date Modified]=Date()-8,1,0)) AS Day8, Sum(IIf([Date Modified]=Date()-7,1,0)) AS Day7, Sum(IIf([Date Modified]=Date()-6,1,0)) AS Day6, Sum(IIf([Date Modified]=Date()-5,1,0)) AS Day5, Sum(IIf([Date Modified]=Date()-4,1,0)) AS Day4, Sum(IIf([Date Modified]=Date()-3,1,0)) AS Day3, Sum(IIf([Date Modified]=Date()-2,1,0)) AS Day2, Sum(IIf([Date Modified]=Date()-1,1,0)) AS Day1, Sum(IIf([Date Modified]=Date(),1,0)) AS Day0, Sum(IIf([Date Modified]>Date()-7,1,0)) AS Last7Days, Sum(IIf([Date Modified]>Date()-30,1,0)) AS Last30Days
FROM Imported
WHERE (((Imported.[Modified By]) Is Not Null))
GROUP BY Imported.[Modified By];

VBA:
Private Sub Form_Load()
Dim strSQL As String
strSQL = "SELECT qryAudit.[Modified By], "
strSQL = strSQL & "Sum(qryAudit.Day14) AS " & Format(DateAdd("d", -14, Date), "\[m\/d\/yy\]") & ", "
strSQL = strSQL & "Sum(qryAudit.Day13) AS " & Format(DateAdd("d", -13, Date), "\[m\/d\/yy\]") & ", "
strSQL = strSQL & "Sum(qryAudit.Day12) AS " & Format(DateAdd("d", -12, Date), "\[m\/d\/yy\]") & ", "
strSQL = strSQL & "Sum(qryAudit.Day11) AS " & Format(DateAdd("d", -11, Date), "\[m\/d\/yy\]") & ", "
strSQL = strSQL & "Sum(qryAudit.Day10) AS " & Format(DateAdd("d", -10, Date), "\[m\/d\/yy\]") & ", "
strSQL = strSQL & "Sum(qryAudit.Day9) AS " & Format(DateAdd("d", -9, Date), "\[m\/d\/yy\]") & ", "
strSQL = strSQL & "Sum(qryAudit.Day8) AS " & Format(DateAdd("d", -8, Date), "\[m\/d\/yy\]") & ", "
strSQL = strSQL & "Sum(qryAudit.Day7) AS " & Format(DateAdd("d", -7, Date), "\[m\/d\/yy\]") & ", "
strSQL = strSQL & "Sum(qryAudit.Day6) AS " & Format(DateAdd("d", -6, Date), "\[m\/d\/yy\]") & ", "
strSQL = strSQL & "Sum(qryAudit.Day5) AS " & Format(DateAdd("d", -5, Date), "\[m\/d\/yy\]") & ", "
strSQL = strSQL & "Sum(qryAudit.Day4) AS " & Format(DateAdd("d", -4, Date), "\[m\/d\/yy\]") & ", "
strSQL = strSQL & "Sum(qryAudit.Day3) AS " & Format(DateAdd("d", -3, Date), "\[m\/d\/yy\]") & ", "
strSQL = strSQL & "Sum(qryAudit.Day2) AS " & Format(DateAdd("d", -2, Date), "\[m\/d\/yy\]") & ", "
strSQL = strSQL & "Sum(qryAudit.Day1) AS " & Format(DateAdd("d", -1, Date), "\[m\/d\/yy\]") & ", "
strSQL = strSQL & "Sum(qryAudit.Day0) AS " & Format(DateAdd("d", -0, Date), "\[m\/d\/yy\]") & " "
strSQL = strSQL & "FROM qryAudit GROUP BY qryAudit.[Modified By];"
Me.Graph1.RowSource = strSQL
Me.Graph1.Requery
End Sub


However, when I generate the graph it is presented as seen in the attached image example.  I would like the formatting to be similar to that of the image 'ee example-2.jpg'.  How would I change the code so that results are displayed with the user data on the same day side by side, and change the X axis to the date with the legend reflecting user (currently the legend will display the dates).  Sorry if this is a simple matter, but I think these Access graphs are somewhat difficult to work with considering the alternatives.

Ryan
ee-example.JPG
EE-example-2.JPG
ASKER CERTIFIED SOLUTION
Avatar of Bevos
Bevos

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Bevos,

I am looking for the answer to same question. How to format x-axis from number to percentage and vice-versa (Access Pivot-chart)?

would be great if you can help me reach a solution.

Thanks Rahul