DNS-LESS Connection to AS/400

lmonaghan

Board Regular
Joined
Nov 27, 2004
Messages
84
My IT department has been trying to figure out a way to use a DNS-less connection so that Excel 2003 files can be deployed across the company without having to configure an ODBC in the control panel.

We have searched numerous websites for the syntax, but cannot seem to get it to run. We can establish a connection by using the following code:

Code:
Dim ConStr

Set con1 = CreateObject("ADODB.Connection")
ConStr = ""
ConStr = ConStr & "Driver=Client Access ODBC Driver (32-bit);"
ConStr = ConStr & "System=10.1.1.10;"
ConStr = ConStr & "UID=NET;"
ConStr = ConStr & "PWD=netgti;"
con1.Open ConStr
MsgBox "Connection Opened!"

However, when we try to incorporate the connection string, I get a Run-time error: '1004' error.

Code:
SQL = "SELECT omnidata.omeyadlm.alusr as PLANNER, omnidata.omeyuser.eyname as NAME " & _
    "FROM omnidata.omeyadlm, omnidata.omeyuser " & _
    "WHERE omnidata.omeyadlm.alusr = omnidata.omeyuser.eyid " & _
    " AND omnidata.omeyadlm.alid='PLANNERS' " & _
    "ORDER BY omnidata.omeyadlm.alusr "

    With ActiveSheet.QueryTables.Add(Connection:="ODBC;Driver={Client Access ODBC Driver (32-bit)};System=10.1.1.10;Uid=NET;Pwd=netgti;" _
        , Destination:=Range("A1"))
        .CommandText = SQL
        .Refresh
    End With

Please help us! Any suggestions??? :confused:
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
I have both sets of code to see if I can get connected to that server and it seems to work. On a separate note, I am trying to use similar path, user id, password, etc. to connect and I can't get it to work. I'll look over your link to see if I can make some sense of it.

Thanks!
 
Upvote 0

Forum statistics

Threads
1,214,982
Messages
6,122,581
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top