View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Diana[_7_] Diana[_7_] is offline
external usenet poster
 
Posts: 20
Default Run Time Error 1004: Application-Defined or Object-Defined Error

On Apr 13, 11:38 am, urkec wrote:
What values do you get if you

MsgBox sSql
MsgBox sConn

before

==Here is where the error is happening:

Set oQt = sh.QueryTables.Add(Connection:=sConn, _
Destination:=sh.Range("A8"), _
SQL:=sSql)

--
urkec


Hello again urkec!

The message boxes give me these values:

MsgBox sSql = And(PO.Order_Date Between '3/1/2006' and '4/13/2007'))
Order By Items.Itemno
MsgBox sConn = WSID=AndyHP5300;Database=Everest_VGI;Network=DBMS

Pretty cool, didn't know you could put a message box right in the
middle of things like that!