In Access 97, I have an append query involving 1 local table plus 3 tables linked in from SQL Server 2000 (the SQL View of the query is shown below). I also have a macro set up to clear several local tables (including the local table involved here) and then run a number of queries, including this append query. When the macro gets to this query, it always blows up with the error message:
[Microsoft][ODBC SQL Server Driver][SQL Server]A column has been specified more than once in the order by list. Columns in the order by list must be unique. (#169)
In fact, the query has only a single field in the order by list, and that field is specified only once. Sometimes, I have been able to get around this problem by manually running this and all subsequent queries after the macro blows up, but now even that doesn't work.
What is causing this error and how can I get around it?
INSERT INTO KronosMostRecentActivity ( ActivityCode, ActivityStartDate, SSN, InitialVisitDate )
SELECT dbo_Activities.ActivityCode, dbo_Activities.ActivityStartDate, KronosT1.SSN, KronosT1.InitialVisitDate
FROM ((KronosT1 INNER JOIN dbo_ApplCert ON (KronosT1.InitialVisitDate = dbo_ApplCert.InitialVisitDate) AND (KronosT1.SSN = dbo_ApplCert.SSN)) INNER JOIN dbo_Enrollment ON (dbo_ApplCert.InitialVisitDate = dbo_Enrollment.InitialVisitDate) AND (dbo_ApplCert.SSN = dbo_Enrollment.SSN) AND (KronosT1.EnrollmentID = dbo_Enrollment.EnrollmentID)) INNER JOIN dbo_Activities ON dbo_Enrollment.EnrollmentID = dbo_Activities.EnrollmentID
ORDER BY dbo_Activities.ActivityStartDate DESC;
[Microsoft][ODBC SQL Server Driver][SQL Server]A column has been specified more than once in the order by list. Columns in the order by list must be unique. (#169)
In fact, the query has only a single field in the order by list, and that field is specified only once. Sometimes, I have been able to get around this problem by manually running this and all subsequent queries after the macro blows up, but now even that doesn't work.
What is causing this error and how can I get around it?
INSERT INTO KronosMostRecentActivity ( ActivityCode, ActivityStartDate, SSN, InitialVisitDate )
SELECT dbo_Activities.ActivityCode, dbo_Activities.ActivityStartDate, KronosT1.SSN, KronosT1.InitialVisitDate
FROM ((KronosT1 INNER JOIN dbo_ApplCert ON (KronosT1.InitialVisitDate = dbo_ApplCert.InitialVisitDate) AND (KronosT1.SSN = dbo_ApplCert.SSN)) INNER JOIN dbo_Enrollment ON (dbo_ApplCert.InitialVisitDate = dbo_Enrollment.InitialVisitDate) AND (dbo_ApplCert.SSN = dbo_Enrollment.SSN) AND (KronosT1.EnrollmentID = dbo_Enrollment.EnrollmentID)) INNER JOIN dbo_Activities ON dbo_Enrollment.EnrollmentID = dbo_Activities.EnrollmentID
ORDER BY dbo_Activities.ActivityStartDate DESC;