0% found this document useful (0 votes)
23 views

' - Create ADO Connection Object: Database Programming With MSDE

This document discusses how to import SQL Server data into an Access database using an Execute statement in ADO or DAO. It provides an example of using ADO to connect to a SQL Server database and select data into an Access table. The document also recommends resources for additional information on database programming using ADO.NET and using MSDE instead of SQL Server.

Uploaded by

Noel Salazar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

' - Create ADO Connection Object: Database Programming With MSDE

This document discusses how to import SQL Server data into an Access database using an Execute statement in ADO or DAO. It provides an example of using ADO to connect to a SQL Server database and select data into an Access table. The document also recommends resources for additional information on database programming using ADO.NET and using MSDE instead of SQL Server.

Uploaded by

Noel Salazar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

You can quickly import SQL Server data into an Access database using an Execute

statement in either ADO or DAO. I prefer ADO but for the benefit of gaining a reference to
Access object model I use DAO.

Private Sub ADOGO()


Dim lcnn As ADODB.Connection
Dim SQL As String

'--Create ADO Connection Object


Set lcnn = New ADODB.Connection
lcnn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
_
"Dbq=DB1.mdb;" & _
"DefaultDir=d:\Temp;" & _
"Uid=Admin;Pwd=;"

SQL = "SELECT * INTO " & _


"[table_data] " & _
"FROM " & _
"[ODBC;Driver=SQL Server; " & _
"SERVER=MySQL_Server;DATABASE=MySQL_DB;" & _
"UID=MySQL_User;PWD=MySQL_Password;]." & _
"[table_data];"

lcnn.Execute SQL
Set lcnn = Nothing
End Sub

For information on database programming using ADO.NET (in VB .NET), see my


book Visual Basic .NET Database Programming.

For information on using MSDE instead of SQL Server, see the tip Database Programming
With MSDE.

You might also like