Why it doesn't work with DNS-less ODBC?

T

Terence

Hi,

I am retrieving data from AS/400 database to a worksheet
using QueryTable and I have the following problem.

Part of my code is as follows:

'*********************************************
conString = "ODBC;Driver={Client Access ODBC Driver (32-
bit)};" & _
"System=myAS400;" & _
"Uid=myID;" & _
"Pwd=myPwd"

With ActiveSheet.QueryTables.Add(Connection:=conString1, _
Destination:=Range("A1"), _
Sql:="select * from.....")
.Refresh
End With
'*********************************************

However, the program got failed at the line ".Refresh" and
the error message is:

" Run-time error '1004':
Application-defined or object-defined error "

Then I tried to remove ".Refresh", the program didn't have
any error message but nothing returned to the worksheet.
Anyone knows how to solve this problem?
thanks a lot.

Terence
 

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