Solved

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

Posted on 2013-12-26
4
387 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

724 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