Announcement

Collapse
No announcement yet.

Access database error in Excel Macro

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Access database error in Excel Macro

    I have an excel file which I created a macro for in Microsoft Access. When I run the macro (excel file) from within Access I am getting the err "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 know that know one else is accessing this file. Can anyone assist?????

  • #2
    Re: Access database error

    Can you give us a tiny hint which versions of Excel and Access it is?

    Does it always happen, or can you sometimes get in OK -- if so, make sure you are correctly closing and dropping connections to access
    Tom Jones
    MCT, MCSE (2000:Security & 2003), MCSA:Security & Messaging, MCDBA, MCDST, MCITP(EA, EMA, SA, EDA, ES, CS), MCTS, MCP, Sec+
    PhD, MSc, FIAP, MIITT
    IT Trainer / Consultant
    Ossian Ltd
    Scotland

    ** Remember to give credit where credit is due and leave reputation points where appropriate **

    Comment


    • #3
      Re: Access database error

      Excel 2010 and Access 2010. I am not too familiar with Access but when I open up the Access database file there are a couple of macros. All the macros work except for that one excel. When I double click on the excel macro within Access the error comes up everytime. Again, I'm not too familiar with databases and not sure why the error is occurring...I'm guessing it maybe a permissions issue since no one else is accessing the file.

      Comment


      • #4
        Re: Access database error

        Can you post the macro code for us?

        Thread moved to Office 2010 forum
        Tom Jones
        MCT, MCSE (2000:Security & 2003), MCSA:Security & Messaging, MCDBA, MCDST, MCITP(EA, EMA, SA, EDA, ES, CS), MCTS, MCP, Sec+
        PhD, MSc, FIAP, MIITT
        IT Trainer / Consultant
        Ossian Ltd
        Scotland

        ** Remember to give credit where credit is due and leave reputation points where appropriate **

        Comment


        • #5
          Re: Access database error in Excel Macro

          How do I post the macro code? I'm not sure how to do that.

          Comment


          • #6
            Re: Access database error in Excel Macro

            Go to VBA editor in excel
            Select code for the problem macro
            Copy
            Create a new post here
            Click "Go Advanced"
            Click the CODE (#) Button
            Paste
            Tom Jones
            MCT, MCSE (2000:Security & 2003), MCSA:Security & Messaging, MCDBA, MCDST, MCITP(EA, EMA, SA, EDA, ES, CS), MCTS, MCP, Sec+
            PhD, MSc, FIAP, MIITT
            IT Trainer / Consultant
            Ossian Ltd
            Scotland

            ** Remember to give credit where credit is due and leave reputation points where appropriate **

            Comment


            • #7
              Re: Access database error in Excel Macro

              When I open up the excel and go into VBA editor. I see Sheet1 and ThisWorkBook under Microsoft Excel Objects directory. When I right click on Sheet1 and view code I get:
              Private Sub Worksheet_SelectionChange(ByVal Target As Range)

              End Sub

              If I right click on ThisWorkBook and select view code I get:
              Private Sub Workbook_Open()

              End Sub

              Comment


              • #8
                Re: Access database error in Excel Macro

                If I open up the Access database file, highlight the excel macro and go to vba editor...the view code is grayed out.....

                Comment


                • #9
                  Re: Access database error in Excel Macro

                  There will be other macros -- is there someone else you can ask to help you get the correct code?
                  Tom Jones
                  MCT, MCSE (2000:Security & 2003), MCSA:Security & Messaging, MCDBA, MCDST, MCITP(EA, EMA, SA, EDA, ES, CS), MCTS, MCP, Sec+
                  PhD, MSc, FIAP, MIITT
                  IT Trainer / Consultant
                  Ossian Ltd
                  Scotland

                  ** Remember to give credit where credit is due and leave reputation points where appropriate **

                  Comment


                  • #10
                    Re: Access database error in Excel Macro

                    Sorry there is no one else. Just to verify, open up the excel spreadsheet. Go to developer tab, select visual basic (vba editor) which opens up the Microsoft Visual Basic for Application. In there I see a VBAProject, then Microsoft Excel Objects, and then a Sheet1 and ThisWorkBook.

                    Am I doing it wrong?

                    Comment


                    • #11
                      Re: Access database error in Excel Macro

                      No, but you will need to look through the objects -- maybe a module file -- in the VBA editor, then find your offending macro
                      Tom Jones
                      MCT, MCSE (2000:Security & 2003), MCSA:Security & Messaging, MCDBA, MCDST, MCITP(EA, EMA, SA, EDA, ES, CS), MCTS, MCP, Sec+
                      PhD, MSc, FIAP, MIITT
                      IT Trainer / Consultant
                      Ossian Ltd
                      Scotland

                      ** Remember to give credit where credit is due and leave reputation points where appropriate **

                      Comment


                      • #12
                        Re: Access database error in Excel Macro

                        Have you linked this spreadhseet? Also is it on a server? If so you can go to the server and computer management - within open files you can double check that the file is not in use. I have seen this before with linked tables\spreadsheets.

                        Comment

                        Working...
                        X