Results 1 to 7 of 7
  1. #1
    AKAnalyst is offline Novice
    Windows 11 Office 365
    Join Date
    Feb 2024
    Posts
    3

    Access database cannot be accessed from new laptop (Windows 11), only from old one (Windows10)

    Hello,

    I have been accessing a database successfully from a laptop with Windows 10. I can still access it from that laptop, but a new laptop (with Windows 11) returns the following error code(s) when I try to access the same database, using the same front end/ autoexec file:

    "There was an error in quering the data. 3151, ODBC--connection to 'SQL Server Native Client 11.0 [database name], 1433' failed. SELECT Current_User as UserName"



    When I click OK, the following error message then appears:
    "There was an error connecting to the database. 91, Object variable or With block variable not set".

    After clicking OK, I then get another error message very similar to the first one above. After clicking OK again, the final error message is "Run-time error '91': Object variable or With block variable not set."

    I am not personally well-versed in VBA or the inner workings of Access. I'm hoping someone can help explain these error messages, and suggest how I can access the database from the new laptop.

    Thank you!

  2. #2
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    A few things jump out:
    -looks like the front-end is connected to a SQL Server back-end; have you ensured that the back-end SQL database is accessible from the new laptop?
    -besides the Access front-end itself you need to install the same SQL Server driver on this new laptop, the one mentioned in the error: SQL Server Native Client 11.0 (note that this is a fairly old one and you should consider upgrading to the lates SQL driver - it will involve changes to the VBA in front-end most likely unless you have a local SettingTable)
    -have you enabled to Trusted Locations for the front-end on this new laptop to ensure the VBA runs unencumbered?
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  3. #3
    Join Date
    Apr 2017
    Posts
    1,679
    Also yoou have to check, how is the connection to BE defined in your FE. In case an ODBC connection defined in your old computer is used instead defining the connection directly in FE, you must create the this ODBC connection in new laptop too (or redesign the FE).

  4. #4
    AKAnalyst is offline Novice
    Windows 11 Office 365
    Join Date
    Feb 2024
    Posts
    3

    Follow up for Vlad:

    Quote Originally Posted by Gicu View Post
    A few things jump out:
    -looks like the front-end is connected to a SQL Server back-end; have you ensured that the back-end SQL database is accessible from the new laptop?
    -besides the Access front-end itself you need to install the same SQL Server driver on this new laptop, the one mentioned in the error: SQL Server Native Client 11.0 (note that this is a fairly old one and you should consider upgrading to the lates SQL driver - it will involve changes to the VBA in front-end most likely unless you have a local SettingTable)
    -have you enabled to Trusted Locations for the front-end on this new laptop to ensure the VBA runs unencumbered?
    Cheers,
    Thank you very much for this Vlad! Due to my ignorance, I need to ask:
    1) How do I ensure that the BE SQL database is accessible from the laptop?
    2) In "trusted locations", how do I specify "the front end"?


    Thanks for your help!

  5. #5
    AKAnalyst is offline Novice
    Windows 11 Office 365
    Join Date
    Feb 2024
    Posts
    3
    Quote Originally Posted by ArviLaanemets View Post
    Also yoou have to check, how is the connection to BE defined in your FE. In case an ODBC connection defined in your old computer is used instead defining the connection directly in FE, you must create the this ODBC connection in new laptop too (or redesign the FE).
    Thank you for this! Might you be able to tell me how to create an ODBC connection in the new laptop?

    Cheers!

  6. #6
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Usually if the new laptop is on the same network with the old and has the same permissions it should be able to connect to the SQL server db. Have you installed the Native Client 11.0 driver? As for the trusted locations you need to go to (on the Access main ribbon in the front-end) File\Options\Trust Center\Trust Center Settings\Trusted Locations\Add Trusted Location and browse for the location of the front-end you are in-you'll need to check the Allow Trusted Locations on the Network if the front-end is not on the C:\ drive (which it should).

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  7. #7
    Join Date
    Apr 2017
    Posts
    1,679
    Quote Originally Posted by AKAnalyst View Post
    Thank you for this! Might you be able to tell me how to create an ODBC connection in the new laptop?
    Windows Administrative Tools>ODBC Data Sources (there you can select between 32 and 64 bit versions).
    Look at your old comp at first, and when there is the connection defined, create it for new comp too (with same name) Or export it, and imoprt it into new comp. When in old comp no connection exist, then look for other solutions.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 08-14-2019, 04:40 PM
  2. Replies: 14
    Last Post: 10-04-2016, 09:29 AM
  3. Replies: 1
    Last Post: 03-21-2015, 11:55 AM
  4. Replies: 2
    Last Post: 11-05-2013, 09:00 AM
  5. Replies: 2
    Last Post: 08-28-2012, 02:11 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