Sorting X Axis of Graph embedded in a Form

  • Thread starter Thread starter Sorting in a Graph
  • Start date Start date
S

Sorting in a Graph

I have months defined in a table that I need on hte X axis of a graph. But
the sort order is alphabetic which does not sort by months of the year. I
have tried putting a sort order by number; but it doesn't work. How can I
sort this with Jan being the first month in the order. Apr and Aug show up
first.
 
You need to update the Row Source property to sort by the month number. If
you can't figure this out, come back with the Row Source SQL view.
 
I have a query defined in the Record Source with this query sorted by the
month number (Months.sort); but doesn't do the sort. I have even put in the
Order By field of the form; but no luck. Maybe I need to not have a joining
of two tables in the query to get this to work. Here's the SQL statement of
the query:

SELECT Months.sort, [Work Class Timewriting].[it Work Class], [Work Class
Timewriting].Month, [Work Class Timewriting].Hours
FROM Months INNER JOIN [Work Class Timewriting] ON Months.Month = [Work
Class Timewriting].Month
ORDER BY Months.sort;
 
Is there a way of building a chart similar to Excel by putting numbers into a
datasheet and not linking the chart to a table or query?
 
This may help: I have created a chart embedded in a form without linking the
form to a table or query. In the Chart: Graph0, it's got the Row SOurce
defined:

TRANSFORM Sum([Hours]) AS [SumOfHours] SELECT [Month] FROM
[qry_it_work_class2] GROUP BY [Month] PIVOT [it Work Class];

How can I add an Order By clause to this statement to get it to sort right.
I have tried before the Group By and at the end; My syntax must not be right
to get it to work.


Sorting in a Graph said:
I have a query defined in the Record Source with this query sorted by the
month number (Months.sort); but doesn't do the sort. I have even put in the
Order By field of the form; but no luck. Maybe I need to not have a joining
of two tables in the query to get this to work. Here's the SQL statement of
the query:

SELECT Months.sort, [Work Class Timewriting].[it Work Class], [Work Class
Timewriting].Month, [Work Class Timewriting].Hours
FROM Months INNER JOIN [Work Class Timewriting] ON Months.Month = [Work
Class Timewriting].Month
ORDER BY Months.sort;


Duane Hookom said:
You need to update the Row Source property to sort by the month number. If
you can't figure this out, come back with the Row Source SQL view.
 
I expect [Month] is the month name. If so, you need to go bac to
qry_it_work_class2 and add a column that is the month number so you can use
SQL like:

TRANSFORM Sum([Hours]) AS [SumOfHours]
SELECT [Month]
FROM [qry_it_work_class2]
GROUP BY [Month], MthNum
ORDER BY MthNum
PIVOT [it Work Class];


--
Duane Hookom
Microsoft Access MVP


Sorting in a Graph said:
This may help: I have created a chart embedded in a form without linking the
form to a table or query. In the Chart: Graph0, it's got the Row SOurce
defined:

TRANSFORM Sum([Hours]) AS [SumOfHours] SELECT [Month] FROM
[qry_it_work_class2] GROUP BY [Month] PIVOT [it Work Class];

How can I add an Order By clause to this statement to get it to sort right.
I have tried before the Group By and at the end; My syntax must not be right
to get it to work.


Sorting in a Graph said:
I have a query defined in the Record Source with this query sorted by the
month number (Months.sort); but doesn't do the sort. I have even put in the
Order By field of the form; but no luck. Maybe I need to not have a joining
of two tables in the query to get this to work. Here's the SQL statement of
the query:

SELECT Months.sort, [Work Class Timewriting].[it Work Class], [Work Class
Timewriting].Month, [Work Class Timewriting].Hours
FROM Months INNER JOIN [Work Class Timewriting] ON Months.Month = [Work
Class Timewriting].Month
ORDER BY Months.sort;


Duane Hookom said:
You need to update the Row Source property to sort by the month number. If
you can't figure this out, come back with the Row Source SQL view.

--
Duane Hookom
Microsoft Access MVP


:

I have months defined in a table that I need on hte X axis of a graph. But
the sort order is alphabetic which does not sort by months of the year. I
have tried putting a sort order by number; but it doesn't work. How can I
sort this with Jan being the first month in the order. Apr and Aug show up
first.
 
The chart can be populated with values in a datasheet. However, you would
need to write code to update these values in you want the chart values to be
dynamic.

I believe SteveA or SteveS used to post code that does this. You might want
to search http://www.groupacg.com/.
 
This worked. GREAT! Thanks for your help!!!

Duane Hookom said:
I expect [Month] is the month name. If so, you need to go bac to
qry_it_work_class2 and add a column that is the month number so you can use
SQL like:

TRANSFORM Sum([Hours]) AS [SumOfHours]
SELECT [Month]
FROM [qry_it_work_class2]
GROUP BY [Month], MthNum
ORDER BY MthNum
PIVOT [it Work Class];


--
Duane Hookom
Microsoft Access MVP


Sorting in a Graph said:
This may help: I have created a chart embedded in a form without linking the
form to a table or query. In the Chart: Graph0, it's got the Row SOurce
defined:

TRANSFORM Sum([Hours]) AS [SumOfHours] SELECT [Month] FROM
[qry_it_work_class2] GROUP BY [Month] PIVOT [it Work Class];

How can I add an Order By clause to this statement to get it to sort right.
I have tried before the Group By and at the end; My syntax must not be right
to get it to work.


Sorting in a Graph said:
I have a query defined in the Record Source with this query sorted by the
month number (Months.sort); but doesn't do the sort. I have even put in the
Order By field of the form; but no luck. Maybe I need to not have a joining
of two tables in the query to get this to work. Here's the SQL statement of
the query:

SELECT Months.sort, [Work Class Timewriting].[it Work Class], [Work Class
Timewriting].Month, [Work Class Timewriting].Hours
FROM Months INNER JOIN [Work Class Timewriting] ON Months.Month = [Work
Class Timewriting].Month
ORDER BY Months.sort;


:

You need to update the Row Source property to sort by the month number. If
you can't figure this out, come back with the Row Source SQL view.

--
Duane Hookom
Microsoft Access MVP


:

I have months defined in a table that I need on hte X axis of a graph. But
the sort order is alphabetic which does not sort by months of the year. I
have tried putting a sort order by number; but it doesn't work. How can I
sort this with Jan being the first month in the order. Apr and Aug show up
first.
 
Back
Top