crosstab report access violation with 8th field
Using Delphi 2009 connected to an access 2003 database.
I'm have a cross tab report generated from a query that includes sub queries for some of its fields (see below).
The query works OK and the results can be seen in a 'live' grid control at design time.
The cross tab report also works fine with several columns added from the query.
However it always fails if I try to add as a column one of the fields that is generated from a sub query.
Then I get 'Access violation at address 0A112C1B in module frxDB12.bpl. Read of address 00000000'
A snippet from the SQL the query uses is below . The reort pivots on WeekNumber, the cell value is the CumulativePresentPercent, all other fields are additional tems on each row. It fails if I try to add AutumHT or XmasHT to the report.
SELECT
tbl_attendance.AdNo ,
tbl_attendance.Legal_Surname ,
tbl_attendance.Gender ,
(SELECT cumulativePresentPercent
FROM tbl_attendance AS T
WHERE t.weeknumber=8
AND t.Adno = tbl_attendance.adno
) AS AutumHT ,
(SELECT cumulativePresentPercent
FROM tbl_attendance AS T
WHERE t.weeknumber=15
AND t.Adno = tbl_attendance.adno
) AS XmasHT ,
tbl_attendance.WeekNumber ,
tbl_attendance.CumulativePresentPercent
FROM
tbl_attendance
I'm have a cross tab report generated from a query that includes sub queries for some of its fields (see below).
The query works OK and the results can be seen in a 'live' grid control at design time.
The cross tab report also works fine with several columns added from the query.
However it always fails if I try to add as a column one of the fields that is generated from a sub query.
Then I get 'Access violation at address 0A112C1B in module frxDB12.bpl. Read of address 00000000'
A snippet from the SQL the query uses is below . The reort pivots on WeekNumber, the cell value is the CumulativePresentPercent, all other fields are additional tems on each row. It fails if I try to add AutumHT or XmasHT to the report.
SELECT
tbl_attendance.AdNo ,
tbl_attendance.Legal_Surname ,
tbl_attendance.Gender ,
(SELECT cumulativePresentPercent
FROM tbl_attendance AS T
WHERE t.weeknumber=8
AND t.Adno = tbl_attendance.adno
) AS AutumHT ,
(SELECT cumulativePresentPercent
FROM tbl_attendance AS T
WHERE t.weeknumber=15
AND t.Adno = tbl_attendance.adno
) AS XmasHT ,
tbl_attendance.WeekNumber ,
tbl_attendance.CumulativePresentPercent
FROM
tbl_attendance