SQL.QUER Returns #REF in Q+ELast reviewed: November 2, 1994Article ID: Q74241 |
SUMMARYThe function SQL.QUERY is equivalent to the command Select SQL Query. This option is not available unless a query window is open. If you use the EXECUTE function to send the SQL.QUERY command using a DDE channel, #REF will be returned unless there is an open Query in Q+E.
MORE INFORMATIONThe following example will NOT work because there is not an open Query in Q+E:
A1 chan=INITIATE("qe","system")
A2 =EXECUTE(chan,"[sql.query('select * from dBASEfile |
c:\excel\qe\emp.dbf WHERE ')]")
A3 =TERMINATE(chan)
A4 =RETURN()
The next example WILL work because it sends commands to Q+E that open a
query window before attempting to modify the query:
A1 chan=INITIATE("qe","system")
A2 =EXECUTE(chan,"[open('d:\excel\xl3\qe\emp.dbf')]")
A3 =EXECUTE(chan,"[sql.query('select * from
d:\excel\xl3\qe\addr.dbf where state=''NC''')]")
A4 =TERMINATE(chan)
A5 =RETURN()
An alternative to opening a file before using SQL.QUERY is to use the
OPEN command to send your SQL statement:
A1 chan=INITIATE("qe","system")
A2 =EXECUTE(chan,"[open('select * from
d:\excel\xl3\qe\emp.dbf WHERE salary > 30000')]")
A3 =TERMINATE(chan)
A4 =RETURN()
The following are other reasons that the line in your macro containing
the EXECUTE and SQL.QUERY commands might fail even though the other
lines execute correctly:
REFERENCES"Q+E for Microsoft Excel User's Guide," pages 70-71, 112
|
KBCategory: kbother
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |