D
Darrell
I am using a crosstab query as the record source for a report and my
problem is that I don't know how many columns the query will actually
return because the number of different values in the column used for the
crosstab will vary depending on the parameter values passed to the
query. Clearly, designing a report for a shifting number of columns is
problematic. How does one handle this situation?
I know there was a similar post on 4/9 regarding number of work days,
but being fairly new to crosstab queries, I didn't follow all the sql of
the response.
The current SQL statement, simplified, is below. It's the Allocation
field which contains the data in question. Often, depending on the
parameter values, only 3 of the 6 possible values will actually be in
the record set returned.
PARAMETERS BeginningDate DateTime, EndingDate DateTime;
TRANSFORM First(PaymentAmount) AS FirstOfPaymentAmount
SELECT ID, [LastName] & (", "+[FirstName]) AS Name, PaymentDate,
ReceiptNumber, PaymentMethod
FROM tblPaymentsReceived
WHERE PaymentDate)>=BeginningDate And PaymentDate)<=EndingDate) AND
ReceiptNumber Is Not Null
GROUP BY ID, [LastName] & (", "+[FirstName]), PaymentDate,
ReceiptNumber, PaymentMethod
ORDER BY ReceiptNumber
PIVOT Allocation;
Any help would be greatly appreciated.
Darrell
problem is that I don't know how many columns the query will actually
return because the number of different values in the column used for the
crosstab will vary depending on the parameter values passed to the
query. Clearly, designing a report for a shifting number of columns is
problematic. How does one handle this situation?
I know there was a similar post on 4/9 regarding number of work days,
but being fairly new to crosstab queries, I didn't follow all the sql of
the response.
The current SQL statement, simplified, is below. It's the Allocation
field which contains the data in question. Often, depending on the
parameter values, only 3 of the 6 possible values will actually be in
the record set returned.
PARAMETERS BeginningDate DateTime, EndingDate DateTime;
TRANSFORM First(PaymentAmount) AS FirstOfPaymentAmount
SELECT ID, [LastName] & (", "+[FirstName]) AS Name, PaymentDate,
ReceiptNumber, PaymentMethod
FROM tblPaymentsReceived
WHERE PaymentDate)>=BeginningDate And PaymentDate)<=EndingDate) AND
ReceiptNumber Is Not Null
GROUP BY ID, [LastName] & (", "+[FirstName]), PaymentDate,
ReceiptNumber, PaymentMethod
ORDER BY ReceiptNumber
PIVOT Allocation;
Any help would be greatly appreciated.
Darrell