I am trying to get an ODBC connection to work from excel. I have copied the excel sheet from a working copy and am trying to point it at a different server. I am a VBA noob and have no idea why it isn't working.
Sheets("DataQuery").Select
reportdate = ActiveSheet.Range("B1").Value
Range("A3").Select
With Selection.QueryTable
.Connection = Array(Array( _
"ODBC;DSN=DSN201 ;Description=JPdb;UID=minedata;PWD=1xx$F;APP=Microsoft® Query;DATABASE=Power;Network=" _
), Array("DBMSSOCN;Address=111.11.221.70,1433"))
.Sql = Array(reportdate)
.Refresh BackgroundQuery:=False
End With
I have not had any luck googling the '1004' error, it seems that it could be many things. Can anyone help, or point me in the direction of some good resources for setting the connection?
Thanks
Sheets("DataQuery").Select
reportdate = ActiveSheet.Range("B1").Value
Range("A3").Select
With Selection.QueryTable
.Connection = Array(Array( _
"ODBC;DSN=DSN201 ;Description=JPdb;UID=minedata;PWD=1xx$F;APP=Microsoft® Query;DATABASE=Power;Network=" _
), Array("DBMSSOCN;Address=111.11.221.70,1433"))
.Sql = Array(reportdate)
.Refresh BackgroundQuery:=False
End With
I have not had any luck googling the '1004' error, it seems that it could be many things. Can anyone help, or point me in the direction of some good resources for setting the connection?
Thanks