Page 1 of 2 12 LastLast
Results 1 to 15 of 25
  1. #1
    fongmac is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    13

    The Microsoft Office Access database engine cannot open or write to the file


    Hopefully someone here can help me. I have an Access database file with excel macro. When I run the excel file within Access, I am getting the error "The Microsoft Office Access database engine cannot open or write to the file "name of query". It is already opened and exclusively by another user, or you need permission to view its data". I've verify that no one else has the file open. I am running Access 2010.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Would have to analyze code. Post code or provide files for analysis. Follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    fongmac is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    13
    How do I post code?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Copy/paste code in post editor between CODE tags, as follows (but without the space inside []).

    [ CODE] code here [ /CODE]

    Or attach files. The instructions are at bottom of my post. Click 'Go Advanced' button at bottom of post window.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    fongmac is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    13
    Maybe I'm explaining this wrong. I have an Access file...when I open up the Access file there is a macro setup which is trying to import two excel files. I'm not sure how to get the code. When I run compact & repair, nothing happens.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Posting Access macro code is more difficult than posting VBA procedure. Attach screenshot or type the lines of macro into post editor. Or attach files.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    fongmac is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    13
    Here is the screenshot:

    Click image for larger version. 

Name:	error.JPG 
Views:	10 
Size:	24.8 KB 
ID:	8812

    That error comes up when I run the macro in the Access file which imports two excel files. The error says it cannot write to the file "Misc"....but there is no "Misc" file. The two spreadsheets do have a "Misc" field which are both blank and does not contain any data. Apparently, this macro import use to work but all of a sudden is no longer working.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    The screenshot I suggested was for macro code, not the error message which we already knew.

    If the code used to work, what has changed?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    fongmac is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    13
    How do i get the macro code?

  10. #10
    fongmac is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    13
    After playing around with the Access file...I went to database tools, Visual basic, and it open the VB window but still don't see where the macro code is.....

  11. #11
    fongmac is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    13
    if i right click on the macro and select "design view" it gives me some information. Is that the macro code?

  12. #12
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Yes, sounds like it. I don't use macros, only VBA, but can sometimes figure out macro. Macro can be converted to VBA procedure.

    Is this a web database?

    You might benefit from a review of:
    http://office.microsoft.com/en-us/ac...010341717.aspx
    http://www.access-vba.net/introducti...ccess-vba.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  13. #13
    fongmac is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    13
    Here is the macro code converted to visual basic:
    Last edited by fongmac; 08-15-2012 at 02:47 PM.

  14. #14
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    You did not build this db? Did this code ever work?

    The TransferSpreadsheet code does not reference the latest version of Excel. Parameter 5 is Microsoft Excel95 format, 9 is for Excel2007. What version of Excel files are you importing from?

    Otherwise, don't see any problem with the code. So only recourse is to provide db for analysis.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  15. #15
    fongmac is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    13
    No I did not build this db. Yes, the code worked before. The version of excel files importing from is 2007. How do I provide db for analysis?
    Last edited by fongmac; 08-15-2012 at 02:58 PM.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 05-10-2012, 07:35 AM
  2. Replies: 1
    Last Post: 09-03-2011, 07:01 PM
  3. Replies: 6
    Last Post: 10-30-2010, 08:42 AM
  4. Replies: 1
    Last Post: 06-23-2010, 10:52 AM
  5. Replies: 1
    Last Post: 03-02-2010, 03:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums