Share via

Grouped Access Report - Conditional Formatting

Anonymous
2019-12-13T15:38:32+00:00

I have an Access crosstab query as data source for a report grouped into two parts, A and B.  I would like to conditionally format the maximum values in each column of the part A group only.  I have searched the web and tried several items discovered in the search but have not found a solution that applies.  For reference, a snapshot of the report is posted below.  Any assistance is greatly appreciated.

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2019-12-13T17:21:02+00:00

Below is a report based on the following simple crosstab query:

TRANSFORM Nz(Sum(Amount),0)

SELECT Format(SaleDate,"mmmm yyyy") AS [Month],

SUM(Amount*IIF(Salestype IN ("Cash","Credit"),1,0)) AS TotalSales

FROM Sales

GROUP BY FORMAT(SaleDate,"mmmm yyyy")

ORDER BY Year(SaleDate), Month(SaleDate)

PIVOT Amount IN ("Cash","Credit");

The maximum Amount in each of the three columns is shown in red by means of the following conditional formatting expressions:

[TotalSales]=DMax("TotalSales","qrySalesByMonth")

[Cash]=DMax("TotalCash","qrySalesByMonth")

[Credit]=DMax("TotalCredit","qrySalesByMonth")

The qrySalesByMonth query is as follows:

SELECT Format(SaleDate,"mmmm yyyy") AS SaleMonth,

SUM(Amount) AS TotalSales,

SUM(Amount * IIF(SalesType="Cash",1,0)) AS TotalCash,

SUM(Amount * IIF(SalesType="Credit",1,0)) AS TotalCredit

FROM Sales

GROUP BY Format(SaleDate,"mmmm yyyy");

In your case you'd need to include some criterion in the conditional formatting expressions, and in your eqivalent of the qrySalesByMonth query to restrict the formatting and the  query to group A only.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

4 additional answers

Sort by: Most helpful
  1. Anonymous
    2019-12-13T18:53:25+00:00

    Ken thank you very much.  I have been stumped with this for several hours and can now move forward.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2019-12-13T16:35:50+00:00

    Here is the SQL view of the query.

    TRANSFORM Count([XXX 28 Day].Area) AS CountOfArea

    SELECT [XXX 28 Day].Sort, [XXX 28 Day].Classification, [XXX 28 Day].Part, Count([XXX 28 Day].Classification) AS Total

    FROM [XXX 28 Day]

    GROUP BY [XXX 28 Day].Sort, [XXX 28 Day].Part, [XXX 28 Day].Classification, [XXX 28 Day].Part

    ORDER BY [XXX 28 Day].Sort

    PIVOT [XXX 28 Day].Area In (511,512,513,514,515,516,521,522,523,524,525);

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2019-12-13T16:25:42+00:00

    Below is a datasheet view of the crosstab query.  I appreciate your help.

    Was this answer helpful?

    0 comments No comments
  4. Duane Hookom 26,825 Reputation points Volunteer Moderator
    2019-12-13T16:10:30+00:00

    I don't see any snapshot of the report. Can you share the SQL view of your crosstab and/or some sample datasheet view of the crosstab?

    Was this answer helpful?

    0 comments No comments