J
Jack
I have used the following sql in the query design view and it works just
fine:
SELECT qryEvents.StartDate, qryEvents.EventName, qryEvents.StartTime
FROM qryEvents
UNION Select datestart, eventname,starttime FROM
qryExpandExternalEventDates
Order by StartDate;
However when I use this exact sql statement(pasted in my code) and then use
the sql in the statement
Set rs = CurrentDb.OpenRecordset(sSQL)
I get the following error: Run time error 3351
"The ORDER BY expression (StartDate) includes fields that are not selected
by the query. Only those fields requested in the first query can be included
in an ORDER BY expression.
What is the difference here?
fine:
SELECT qryEvents.StartDate, qryEvents.EventName, qryEvents.StartTime
FROM qryEvents
UNION Select datestart, eventname,starttime FROM
qryExpandExternalEventDates
Order by StartDate;
However when I use this exact sql statement(pasted in my code) and then use
the sql in the statement
Set rs = CurrentDb.OpenRecordset(sSQL)
I get the following error: Run time error 3351
"The ORDER BY expression (StartDate) includes fields that are not selected
by the query. Only those fields requested in the first query can be included
in an ORDER BY expression.
What is the difference here?