VB Macro

G

Gopal

Hi EveryBody,

I am trying to fetch data from Oracle 8i using Microsoft
ODBC Driver using the following code, it's working fine in
my machine but not so with other machine(s) , I verified
the OS configuration it is same as my machine , and there
is no problem with ODBC Driver too. Here is my Error
Message

"General ODBC Error 1004" , at line ".Refresh
BackgroundQuery:=False"

Any help will be highly appreciated

Here is my Code:
****************
Range("A1").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"ODBC;DRIVER={Microsoft ODBC for
Oracle};UID=ewinnie;PWD=ewinnie;SERVER=ewinnie;" _
, Destination:=Range("A1"))
.CommandText = Array( _
"SELECT s.SKU, s.SKU_DESC, d.DAT_PRICE,
s.UNITS_PER_CASE, s.UNIT_WT, s.CASES_PER_PALLET,
g.GRP_DESC" & Chr(13) & "" & Chr(10) & "FROM
EWINNIE.sku_dat d, EWINNIE.sku_groups g,
EWINNIE.sku_profile s" & Chr(13) & "" & Chr(10) & "WHERE
s.SKU = d.SKU AND g.SKU_G" _

, _
"RP_ID = s.SKU_GRP5 AND ((s.ACTIVE_FLAG='Y') AND
(d.COMPANY_NO=g.company_no And d.COMPANY_NO='1') AND
(d.DEAL_CD=upper('" & Order_Form & "')) AND
(d.ACTIVE_FLAG='Y') AND (g.SKU_GRP_TYPE='SKU_GROUP5'))" &
Chr(13) & "" & Chr(10) & "ORDER BY g.GRP_DESC," _

, " s.SKU")


.FieldNames = True
.RefreshStyle = xlInsertDeleteCells
.RowNumbers = False
.FillAdjacentFormulas = False
.RefreshOnFileOpen = False
.HasAutoFormat = True
.BackgroundQuery = True
.TablesOnlyFromHTML = True
.Refresh BackgroundQuery:=False
.SavePassword = True
.SaveData = True
End With
 
G

Guest

Thank you Dennis for your response, but I am able to
connect to this database using sqlplus from the other
machine , and hence I assume they have rights to access
this database.

Any other idea ??

Thanks
Gopal
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top