Avatar of Sandra Smith
Sandra Smith
Flag for United States of America asked on

Connection string to ACCESS 2010 From EXCEL 2010 no longer recognizes file

I have been using he below to import data but now it says it does no recognize the file!  I am opening ACCESS 2010 table from Excel 2010 with a select query, but now it won't even open the connection.  Any suggestions on what I could look for to figure out why it worked and now won't?  When I try to open with the Data tab using a query, I also now get unrecognized format, but it all looks fine.

Sandra

Dim conn As New ADODB.Connection
Dim rst As New ADODB.Recordset
Dim sSQL As String
Dim rng As Range
Dim Wks As Worksheet
Dim strCellAddress As String
Dim rngName As Range


    Set conn = New ADODB.Connection
    conn.Provider = "Microsoft.ACE.OLEDB.12.0;"
    conn.ConnectionString = strDatabasePath
    conn.Open
    Set rng = ThisWorkbook.Worksheets("ListData").Range("A6")

    Set rst = New ADODB.Recordset
Microsoft ApplicationsMicrosoft DevelopmentMicrosoft Excel

Avatar of undefined
Last Comment
Sandra Smith

8/22/2022 - Mon
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP 2010-2015

Where is the variable strDatabasePath DIM'ed?

Where is the value for strDatabasePath set?

Does strDatabasePath still have the correct path tot eh database (.accdb)?
Sandra Smith

ASKER
The variable  is defined in the calling procedure and passed in as a string and the path was the first thing I checked
ASKER CERTIFIED SOLUTION
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP 2010-2015

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Sandra Smith

ASKER
I did all this. It it did lead me to the answer.  It is not the database, it is my machine.  When I moved to my laptop, it worked.  At least I can finish, but have to repair my main machine.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck