Results 1 to 3 of 3
  1. #1
    JimReid is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2022
    Location
    Erial , New Jersey
    Posts
    30

    Unhappy Running Access on different operating systems

    This rather interesting (and a pain while developing). I have a customer running Windows 10 and Access 2016. I copied his tables, querys and forms to my machine (Windows 11 Pro with Office 2021. It said that the access database I created from the copies was 2016 so I thought all was cool. The querys seem to work fine. Tables seem good. And the program that works off of the Form works good THE FIRST TIME. The second..... says I can't update anything because it is still opened by another user (Admin)??? I'm the only user and yes I'm admin also. Don't have this problem on the customer machine but then again I didn't set it up.



    What is confusing is I get and error on an excel object the second time:
    If ActiveSheet.Name <> rs.Fields("Route") Then
    The error says: Run-time error '91'
    Object variable or With block variable not set

    I don't have a 'With' in the program.
    The object variable is: Public XL As Excel.Application Public WB As Excel.Workbook
    Set WB = XL.Workbooks.Add
    Set WKS = WB.Worksheets(1)



    When I set WKS the sheet1 is created and is visible. Then when I execute the IF statement it seems to be gone.

    Any ideas? The program works fine on Windows 10 under Access 2016

    Thanks folks,

    Jim

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,552
    I believe you would need to fully reference the sheet?
    Activesheet.Name is fine in Excel but not in Access?

    xl.Activesheet.Name might work?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,928
    suggest late bind your excel references rather than early bid as you are doing at the moment - a 2016 version of access/excel/whatever will not recognise an earlier version. Later versions will update a library from an earlier version. Late binding means it will use whatever version is available and will work providing that version has the bells and whistles required.

    Other possibility is it is a recently introduced bug as a result of a windows update - win11 seems particularly prone at the moment

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

Similar Threads

  1. Replies: 10
    Last Post: 04-07-2020, 05:40 PM
  2. Replies: 2
    Last Post: 06-08-2017, 07:32 AM
  3. Replies: 4
    Last Post: 08-21-2012, 11:10 AM
  4. Operating systems
    By nashr1928 in forum Access
    Replies: 3
    Last Post: 12-05-2011, 03:24 PM
  5. MS-Access in 64 Bit operating systems
    By todd in forum Programming
    Replies: 2
    Last Post: 08-26-2010, 04:25 PM

Tags for this Thread

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