Results 1 to 5 of 5
  1. #1
    Philosophaie is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    28

    Insert a ".mdf" database into Access

    From Excel VBA, how do you insert a ".mdf" database into Access say "Northwind.mdf".

    I tried:

    Code:
        Dim conn As New ADODB.Connection
        Dim rs As New ADODB.Recordset
        conn.Open ConnectionString:="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\path\Northwind.mdf;"
        strSQL = "SELECT * FROM [Customers];"
        rs.Open strSQL, conn
        'code
        rs.Close
        conn.Close
        Set rs = Nothing
        Set conn = Nothing
    Is it possible?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,936
    Never heard of .mdf file extension.

    What happens when you run the code - error message, wrong results, nothing?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Philosophaie is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    28
    I know it will not work in this for just looking for some hints to see if it can be done.

    Error code:

    "Unrecognized database format"

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,936
    Okay, this somewhat explains what an .mdf is http://www.access-programmers.com/file-extensions.aspx

    But I have no idea if Access can connect to mdf.

    http://www.mssqlcity.com/articles/ad...h_database.htm
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    tanvi is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    100
    Quote Originally Posted by Philosophaie View Post
    I know it will not work in this for just looking for some hints to see if it can be done.

    Error code:
    Found a good post on error: "Unrecognized database format"

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 06-22-2012, 04:00 AM
  2. Replies: 11
    Last Post: 03-29-2012, 02:32 PM
  3. VBA code syntac doubt "Before Insert"
    By ramindya in forum Programming
    Replies: 1
    Last Post: 02-12-2012, 07:52 PM
  4. Replies: 2
    Last Post: 11-04-2011, 02:45 AM
  5. Replies: 5
    Last Post: 05-23-2011, 11:28 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums