Thanks Thanks:  0
Likes Likes:  0
Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: RunTime Error 7866

  1. #1
    New Member
    Join Date
    May 2007
    Posts
    16
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default RunTime Error 7866

    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

  2. #2
    Board Regular littleiitin's Avatar
    Join Date
    Apr 2010
    Location
    Delhi, India
    Posts
    401
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: RunTime Error 7866

    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?

  3. #3
    New Member
    Join Date
    May 2007
    Posts
    16
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: RunTime Error 7866

    Thanks for your reply

    Yes, The Database is in a shared drive.

  4. #4
    Board Regular
    Join Date
    May 2009
    Location
    Delhi
    Posts
    355
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: RunTime Error 7866

    what's the error message?
    Regards,
    Gautam S

  5. #5
    New Member
    Join Date
    May 2007
    Posts
    16
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: RunTime Error 7866

    Thanks G2k

    The Error is RunTime Error 7866 Microsoft Access cannot open the database because it is missing, or opened exclusively by another user

  6. #6
    Board Regular
    Join Date
    May 2009
    Location
    Delhi
    Posts
    355
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: RunTime Error 7866

    have you chaged your access database default open mode as shared??

    Please Check Tools-Option-Advanced - Default opend mode -Shared.
    Regards,
    Gautam S

  7. #7
    New Member
    Join Date
    May 2007
    Posts
    16
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: RunTime Error 7866

    Quote Originally Posted by G2K View Post
    have you chaged your access database default open mode as shared??

    Please Check Tools-Option-Advanced - Default opend mode -Shared.
    Thanks, Yes it is already set to shared.

  8. #8
    MrExcel MVP
    Moderator
    RoryA's Avatar
    Join Date
    May 2008
    Location
    UK
    Posts
    32,490
    Post Thanks / Like
    Mentioned
    27 Post(s)
    Tagged
    3 Thread(s)

    Default Re: RunTime Error 7866

    Might be helpful to see the code...

  9. #9
    New Member
    Join Date
    May 2007
    Posts
    16
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: RunTime Error 7866

    Quote Originally Posted by rorya View Post
    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

  10. #10
    MrExcel MVP
    Moderator
    RoryA's Avatar
    Join Date
    May 2008
    Location
    UK
    Posts
    32,490
    Post Thanks / Like
    Mentioned
    27 Post(s)
    Tagged
    3 Thread(s)

    Default Re: RunTime Error 7866

    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?

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •