Solved

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

Posted on 2013-12-26
4
386 Views
Last Modified: 2013-12-28
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
0
Comment
Question by:ssmith94015
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 21
ID: 39740952
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)?
0
 

Author Comment

by:ssmith94015
ID: 39740965
The variable  is defined in the calling procedure and passed in as a string and the path was the first thing I checked
0
 
LVL 21

Accepted Solution

by:
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP earned 500 total points
ID: 39741018
Thanks for the info.

Have you tried opening the database to see if it needs repaired?  Be sure t make a backup before opening the database with Access just to be sage.

I would also run compact on the database after you make a backup. That will hep you cjheck to be sure the database is good.
0
 

Author Closing Comment

by:ssmith94015
ID: 39743800
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.
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question