RunTime Error 7866

NearlyMad

New Member
Joined
May 3, 2007
Messages
16
Hi

I hope someone can give me some guidance on this.

I have a macro running in Excel that opens an Access Database and runs some queries. This works perfectly on my PC, However when I run it on a colleagues PC we get the Error.

I have checked the References and all are present and I have checked that the Addins are all the same.

The Filepath is the same - no mapping issues.

Anybody got any ideas of what else to check

Many Thanks
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Hi,
Welcome to the board..

Did you created same Database name on your friend's PC? Did the table name is same as in your queries?
 
Upvote 0
Thanks G2k

The Error is RunTime Error 7866 Microsoft Access cannot open the database because it is missing, or opened exclusively by another user
 
Upvote 0
have you chaged your access database default open mode as shared??

Please Check Tools-Option-Advanced - Default opend mode -Shared.
 
Upvote 0
Might be helpful to see the code...;)
 
Upvote 0
Might be helpful to see the code...;)

Const Dbase = "Ad-hoc Request Database_2003 .mdb"
'Const FileLoc = "J:\GMSBA Acquiring\Stuart\"
Const FileLoc = "J:\GMSBA Acquiring\Data Requests\Database&Forms\"

Sub RunAccessQuery()
Dim A As Object

Set A = CreateObject("Access.Application")

A.OpenCurrentDatabase (FileLoc & Dbase)

A.DoCmd.OpenQuery ("How Many Received")
A.DoCmd.OutputTo acOutputQuery, "How Many Received", acFormatXLS, FileLoc & "How Many Received.xls"
A.DoCmd.Close
A.DoCmd.OpenQuery ("Time Taken to Complete")
A.DoCmd.OutputTo acOutputQuery, "Time Taken to Complete", acFormatXLS, FileLoc & "Time Taken to Complete.xls"
A.DoCmd.Close
A.DoCmd.OpenQuery ("COMPLETED REQUEST STATS")
A.DoCmd.OutputTo acOutputQuery, "COMPLETED REQUEST STATS", acFormatXLS, FileLoc & "COMPLETED REQUEST STATS.xls"
A.DoCmd.Close
A.DoCmd.OpenQuery ("OUTSTANDING STATS")
A.DoCmd.OutputTo acOutputQuery, "OUTSTANDING STATS", acFormatXLS, FileLoc & "OUTSTANDING STATS.xls"
A.DoCmd.Close
A.CloseCurrentDatabase
End Sub
 
Upvote 0
Does that user get the error every time? (I assume you checked the default open mode on his machine, not just yours) Can he open the database manually using the mapped J: drive path?
 
Upvote 0

Forum statistics

Threads
1,213,520
Messages
6,114,099
Members
448,548
Latest member
harryls

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