Error refreshing two Data Connections to the same Access DB

Roseus

Board Regular
Joined
Dec 20, 2010
Messages
87
I have two data connections to different queries in the same Access DB. The second one always fails (regardless of which I run first).

When I look at the database, I notice that it has a lock file after I attempt the Refresh (not before), which I think is causing the problem. It stays locked until I close the Excel file. Can anyone help me to unlock the db as soon as my import is complete, so the second connection will run?
# # #
Additional Info

I'm using Excel and Access 2010.

The error:

"The text file specification 'MyQuery Link Specification' does not exist. You cannot import, export, or link using the specification.
Connection String (note: I'm using Command type: Table):
Code:
Provider=Microsoft.ACE.OLEDB.12.0;User ID=Admin
;Data Source=A:\folder\folder\My Database.accdb
;Mode=Share Deny None
;Extended Properties=""
;Jet OLEDB:System database=""
;Jet OLEDB:Registry Path=""
;Jet OLEDB:Engine Type=6
;Jet OLEDB:Database Locking Mode=0
;Jet OLEDB:Global Partial Bulk Ops=2
;Jet OLEDB:Global Bulk Transactions=1
;Jet OLEDB:New Database Password=""
;Jet OLEDB:Create System Database=False
;Jet OLEDB:Encrypt Database=False
;Jet OLEDB:Don't Copy Locale on Compact=False
;Jet OLEDB:Compact Without Replica Repair=False
;Jet OLEDB:SFP=False
;Jet OLEDB:Support Complex Data=False
;Jet OLEDB:Bypass UserInfo Validation=False

This question is a cross-post which I asked 5 days ago.

Lastly, based on this post, I've tried changing my Mode from "Share Deny None" to "Read", but it didn't help. Nor do I understand why it would have, but I tried.
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Can you post all of your code. Are you closing the connection and disposing of it prior to making the second connection?
 
Upvote 0
Can you post all of your code. Are you closing the connection and disposing of it prior to making the second connection?

The code is very simple:

Code:
ActiveWorkbook.Connections("Connection1").Refresh
ActiveWorkbook.Connections("Connection2").Refresh

I'm not sure how to close the connection thereafter. Since it's just a simple Refresh, I would think it would close itself after it was complete, but that doesn't seem to be the case.
 
Upvote 0

Forum statistics

Threads
1,216,172
Messages
6,129,290
Members
449,498
Latest member
Lee_ray

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top