Connecting to System via DSN

Snailspace

Board Regular
Joined
Jan 28, 2009
Messages
56
I’m trying to access a table on my works server, I’ve managed to connect and import using data import, which if recorded produces the following
Rich (BB code):
'      With ActiveSheet.QueryTables.Add(Connection:="ODBC;DSN=CAMIRA01;", _<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
'        Destination:=Range("A1"))<o:p></o:p>
'        .CommandText = Array("SELECT * FROM ""CAMIRA01"".""CMED"".""CREDITLIST""")<o:p></o:p>
'        .Name = "CAMIRA01 CREDITLIST"<o:p></o:p>
'        .FieldNames = True<o:p></o:p>
'        .RowNumbers = False<o:p></o:p>
'        .FillAdjacentFormulas = False<o:p></o:p>
'        .PreserveFormatting = True<o:p></o:p>
'        .RefreshOnFileOpen = False<o:p></o:p>
'        .BackgroundQuery = True<o:p></o:p>
'        .RefreshStyle = xlInsertDeleteCells<o:p></o:p>
'        .SavePassword = True<o:p></o:p>
'        .SaveData = True<o:p></o:p>
'        .AdjustColumnWidth = True<o:p></o:p>
'        .RefreshPeriod = 0<o:p></o:p>
'        .PreserveColumnInfo = True<o:p></o:p>
'        .SourceConnectionFile = _<o:p></o:p>
'        "C:\Documents and Settings\cmed\My Documents\My Data Sources\CAMIRA01 CREDITLIST.odc"<o:p></o:p>
'        .Refresh BackgroundQuery:=False<o:p></o:p>
'    End With
<o:p></o:p>
I’d like to query the table using ADODB, however I’m struggling to get the connectionstring I need to connect to the table.
The System DSN is an iSeries Access ODBC Driver.
<o:p> </o:p>
Thanks for any help<o:p></o:p>
SP
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Forum statistics

Threads
1,224,518
Messages
6,179,248
Members
452,900
Latest member
LisaGo

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