+ Reply to Thread
Results 1 to 8 of 8

Connecting Excel to Access General Question

  1. #1
    Registered User
    Join Date
    07-31-2012
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    30

    Connecting Excel to Access General Question

    Hi,
    I have an Excel document the connects to Access database. I make this connection in 11 subroutines in various modules. The code below is an example of one of the connections.

    1. The code works great for me in my test environment. I moved the Excel document and the Access file to my live environment mimicking my test environment setup. I have read/write access to all the folders in my live environment, and I updated the Access file path in my code. When I open the Excel document, it works great. However, when I had someone who does not have read/write access to the folder containing the Access database, the connection fails. Is my issue the security rights of the user? If so, how can I make this work. I have about 30 users who will be using the Excel budget document, and I don't want them to have access to the Access database.

    2. The code for connecting to the Access database is written in 11 different subroutines. Is there a way that I can do the connection so that I don't have to update 11 different subroutines Access database file path?

    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    07-31-2012
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    30

    Re: Connecting Excel to Access General Question

    After doing more searches, I figured out a workaround the security issue for the folder the Access database is located in. I moved the Access database to a folder that all my users have read/write Access and then I password protected the Access database. It was essential that I did the following.
    1. In the Access File Options > Client Settings > select "Use legacy encryption".
    2. In the VBA code put the password.

    Please Login or Register  to view this content.
    Still hoping to get advice about my second question.

    Thanks,
    Karen

  3. #3
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,223

    Re: Connecting Excel to Access General Question

    Ad2.
    1. Declare a global variable at the beginning of the standard module:
    Please Login or Register  to view this content.
    2. Delete assigning a value to this variable and remove the declarations in all procedures.

    Depending on your needs, you will comment on one and uncomment the other public declaration.

    Artik

  4. #4
    Registered User
    Join Date
    07-31-2012
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    30

    Re: Connecting Excel to Access General Question

    Hi Artik,

    I neglected to say that the subroutines are in different modules. I did this just to help me stay organized while developing the code.

    Need to verify what I am supposed to do based on your advice.
    1. Get all the subroutines located in the same module.
    2. At the beginning of this module declare the public global variable.
    3. Remove the declaration in each individual subroutine in the module.

    Thanks for your time.
    Karen

  5. #5
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: Connecting Excel to Access General Question

    You can declare the Public variables as outlined above but you then need to set say the stringpath for the directory path in the code for the form initialise. Like

    Please Login or Register  to view this content.
    Or The Workbook Open event
    And then
    Please Login or Register  to view this content.
    and in your other routines call upon it

    Please Login or Register  to view this content.
    Last edited by nigelog; 09-03-2021 at 09:06 AM.

  6. #6
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,223

    Re: Connecting Excel to Access General Question

    Sorry. It was late and I made mistakes in my speech.
    1. You declare a public constant in one of the standard modules. I devote a separate module to this type of declaration:
    Please Login or Register  to view this content.
    2. Corrected procedure below (fragment). I have marked the lines of code to be removed:
    Please Login or Register  to view this content.
    3.If in any procedure you have used a variable name other than ACCESSFILE, you must correct it to the name of this public constant.

    Artik

  7. #7
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: Connecting Excel to Access General Question

    @ Artik

    Thanks, much better way than the way I was doing it.

  8. #8
    Registered User
    Join Date
    07-31-2012
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    30

    Re: Connecting Excel to Access General Question

    Hi Artik,

    Thank you for the great directions. It WORKED!! The simplicity of solution is much appreciated. This saves so much time and reduces the chance of human error on my part.

    Karen

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. General advice on connecting Excel to an Oracle Database
    By Nerdio in forum Access Tables & Databases
    Replies: 5
    Last Post: 02-11-2015, 01:59 PM
  2. [SOLVED] General Access Form question
    By BrownBoy in forum Access Tables & Databases
    Replies: 3
    Last Post: 10-17-2014, 11:54 AM
  3. General Access Question
    By Squint in forum Access Tables & Databases
    Replies: 0
    Last Post: 01-22-2014, 11:25 AM
  4. Use a variable when connecting excel to access with vba
    By rbyrd023 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-23-2012, 12:17 PM
  5. New to Access... general question
    By drewbagel423 in forum Access Tables & Databases
    Replies: 0
    Last Post: 02-05-2009, 04:25 PM
  6. Connecting Excel with access 2007
    By vikas.bhandari in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-01-2007, 08:59 AM
  7. [SOLVED] Connecting Excel, Access and SQL Server
    By mp80237 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-01-2006, 12:00 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1