Re: INSERT INTO..SELECT

From: Jamie Collins (jamiecollins_at_xsmail.com)
Date: 07/26/04


Date: 26 Jul 2004 08:48:37 -0700


"David Weilmuenster" wrote ...

> Have tried to record a macro in Excel 2002 that uses the
> SQL INSERT INTO..SELECT statements.
>
> The problem: Although I can get the database result that
> I want in the spread*** by manually entering the actions
> during the macro recording process, when I stop recording,
> the resulting macro is empty.
>
> Have confirmed that I can sucessfully record a macro to
> execute SQL if I omit the INSERT INTO statement, and leave
> only the SELECT statement.

If you are referring to a Jet or SQL Server data source, I assume the
problem would be that the INSERT INTO..SELECT syntax does not return a
result set and the macro recorder stops recording when the MS Query
wizard is cancelled.

> Any workarounds?

The workarounds depend on what you are trying to achieve. If your goal
is to learn how to write sql or VBA, I must tell you that both the
macro the recorder and the MS Query wizard write lousy code <g>.

Jamie.

--