I have an Excel VBA workbook that generates an SQL statement as a string. I pass this SQL to the record set object and use the CopyFromRecordSet function to load the data into an Excel worksheet.
The above method gives me 67 entries. If I take the exact SQL generated in VBA and paste it into a new query in Access, it will provide 400 records.
SQL:
SELECT tbJob.jobID, tbTasks.tskName, tbTaskCat.catName, tbTasks.tskActivity, tbJob.JobDueDate, tbJob.jobCompletedDate, tbJob.jobCreatedOn, tbJobStatus.statusDes, tbStaff.staffForename & ' ' & tbStaff.staffSurname AS Assignee FROM tbJobStatus INNER JOIN (tbStaff INNER JOIN (tbTaskCat INNER JOIN (tbTasks INNER JOIN tbJob ON tbTasks.tskID = tbJob.jobTaskID) ON tbTaskCat.catID = tbTasks.tskCatID) ON tbStaff.staffID = tbJob.jobAssignedToID) ON tbJobStatus.statusID = tbJob.jobStatusID WHERE tbJob.jobStatusID = 4 AND tbJobStatus.statusDes <> 'Deleted' ORDER BY tbJob.jobID;
I am trying to explain why the difference occurs. Any help would be greatly appreciated. I searched the Internet, but could not find a solution, if you know it, send the link.
Thanks in advance.
Stewart
source share