ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Changing data access from MSAccess2000 to SQL Server (https://www.excelbanter.com/excel-programming/320855-changing-data-access-msaccess2000-sql-server.html)

Jason

Changing data access from MSAccess2000 to SQL Server
 
I am currently writing a program in Excel that will take data off of a SQL
server and dump it into an excel spreadsheet so that i can crunch numbers and
display the information. I used an access database with dummy information to
work on crunching the numbers because the serverwas not set up yet, but now i
want to grab the data off of the database we set up on the server instead of
the access file. i used a JET object to grab the data from the access file,
but i am having quite a hard time getting the data off of the server. this
is the code i used for the Access:

Set myConn = New ADODB.Connection
Set myRec = New ADODB.Recordset
myConn.Provider = "Microsoft.jet.oledb.4.0"
myConn.Open "\\yodisk2\shryork\tober\glassing1.mdb"

This is the code I am attempting to use for the SQL:

myConn.Provider = "SQLOLEDB.1"
myConn.ConnectionString= "DATABASE=glassPLC1;SERVER=yosql1;"

I am not sure why this is not working. Any advice would be greatly
appreciated. Thank you.


Jamie Collins

Changing data access from MSAccess2000 to SQL Server
 

Jason wrote:
I am currently writing a program in Excel that will take data off of

a SQL
server and dump it into an excel spreadsheet so that i can crunch

numbers and
display the information. I used an access database with dummy

information to
work on crunching the numbers because the serverwas not set up yet,

but now i
want to grab the data off of the database we set up on the server

instead of
the access file. i used a JET object to grab the data from the

access file,
but i am having quite a hard time getting the data off of the server.

this
is the code i used for the Access:

Set myConn = New ADODB.Connection
Set myRec = New ADODB.Recordset
myConn.Provider = "Microsoft.jet.oledb.4.0"
myConn.Open "\\yodisk2\shryork\tober\glassing1.mdb"

This is the code I am attempting to use for the SQL:

myConn.Provider = "SQLOLEDB.1"
myConn.ConnectionString= "DATABASE=glassPLC1;SERVER=yosql1;"

I am not sure why this is not working. Any advice would be greatly
appreciated. Thank you.



Jamie Collins

Changing data access from MSAccess2000 to SQL Server
 

Jason wrote:

This is the code I am attempting to use for the SQL:

myConn.Provider = "SQLOLEDB.1"
myConn.ConnectionString= "DATABASE=glassPLC1;SERVER=yosql1;"


Try changing DATABASE to INITIAL CATALOG.

Jamie.

--



All times are GMT +1. The time now is 08:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com