I am opening an ADO recordset in code and although I am using an SQL SELECT string that should bring back records, the recordset is opening with both EOF and BOF set to true. I know that the SQL brings back records because I’ve printed it in the immediate window then pasted the text into the SQL view of a query, where it works fine and returns records.
The SQL string I am using (copied from the immediate window) is:
SELECT tbl_WeeklyTotals.BranchCode, dbo_branch.branch_sht_name, tbl_WeeklyTotals.AgrWeek, tbl_WeeklyTotals.Amount, tbl_WeeklyTotals.NumTxs, tbl_WeeklyTotals.Units, tbl_WeeklyTotals.Footfall, [NumTxs]/[Footfall] AS FootfallConversion, [Amount]/[NumTxs] AS AveTxVal, [Amount]/[Units] AS AveUnitVal, [Units]/[NumTxs] AS AveUnitsPerTx FROM dbo_branch RIGHT JOIN tbl_WeeklyTotals ON dbo_branch.branch_code = tbl_WeeklyTotals.BranchCode WHERE tbl_WeeklyTotals.BranchCode = ‘00001’ AND tbl_WeeklyTotals.AgrWeek Like ‘2004*’ ORDER BY tbl_WeeklyTotals.AgrWeek;
The code I am using to open the recordset is:
rst.Open strSQL, CurrentProject.Connection, , , adCmdText
I