Live with Dot Net Just another Programming weblog

How to import MS SQL Server Data into MS Access database

Posted on January 30, 2012

The following simple code will import the MS SQL Server data/table into an Access Database. It uses ADO.

1
2
3
4
5
6
7
'Set Reference to ADODB
Private Sub Import_MS_SQL_Server_Data_Into_MS_Access()
    Dim cn As New Adodb.Connection
    cn.Open "Driver={Microsoft Access Driver (*.mdb)};Dbq=Your_Access_Database.mdb;DefaultDir=C:\test;Uid=admin;Pwd=admin;"
    cn.Execute "SELECT * INTO [table_data] FROM [ODBC;Driver=SQL Server; SERVER=MySQL_Server;DATABASE=MySQL_DB;UID=MySQL_User;PWD=MySQL_Password;].[table_data];"
    cn = Nothing
End Sub

About admin

No description. Please complete your profile.
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.