Share via

MSACCESS Active X Button creation error, "Invalid use of Null"

Phillip Corbin 0 Reputation points
2026-02-06T17:17:12.65+00:00

When linked to OneDrive, the MSACCESS adds a button to a form; "Invalid Use of Null" error is not a problem.

When creating the same form on a thumb drive, the "Invalid Use of Null: error is a problem; stopping the Active X creation?

Note when clicking the button when creating the button.

All other Active X control functions are normal.

Using an older MSACCESS without "365," the error does not occur.

Microsoft 365 and Office | Access | For business | Windows
{count} votes

2 answers

Sort by: Most helpful
  1. Austin-H 8,180 Reputation points Microsoft External Staff Moderator
    2026-02-06T23:49:11.3933333+00:00

    Hi @Phillip Corbin
    Thank you for reaching out to the Microsoft Q&A forum.

    Based on the information you shared, I understand that when your Access database is stored on OneDrive, MS Access is able to add an ActiveX button to a form without any issues. However, when the same form is created from a thumb drive (USB), you encounter an “Invalid use of Null” error, which stops the ActiveX control from being created. This issue does not occur in older (non-Microsoft 365) versions of Access, and all other ActiveX controls appear to function normally.

    After researching this behavior, it appears to be caused by a combination of security restrictions in Microsoft Access 365 and environment trust differences between OneDrive and removable media.

    OneDrive is treated as a trusted/local location, while USB drives are considered untrusted or external. Access 365 applies stricter security rules to untrusted locations, which can restrict ActiveX initialization or block access to certain system values. This can result in expected values returning Null, leading to the Invalid use of Null error.

    Please try to create an ActiveX button requires Windows to correctly register required OCX/DLL libraries. When running from a USB drive, Access may fail to access or register these components, causing missing references or Null values internally.

    The Invalid use of Null error typically occurs when code attempts to assign or evaluate a Null value in a context that does not allow it. In secured environments (like Access 365 + USB), some system properties or control values may unexpectedly return Null. When the error occurs, click Debug to identify the exact line of code causing the issue. To help troubleshoot this properly, could you please:

    • Share the VBA code behind the button
    • Indicate which line triggers the error when Debug is clicked

    You can send this information via private message if preferred.

    I hope this explanation helps clarify why the behavior differs between environments.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Q&A Assist
    2026-02-06T17:17:24.2133333+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The "Invalid Use of Null" error in MS Access can occur for various reasons, particularly when dealing with ActiveX controls. Since you mentioned that this error does not occur when linked to OneDrive but does when using a thumb drive, it may be related to how the database is accessing or referencing data stored locally versus in the cloud.

    Here are a few considerations that might help resolve the issue:

    1. Data Source Issues: Ensure that the data sources linked to your forms are correctly set up and accessible from the thumb drive. If the database is trying to reference data that is not available or is null, it could trigger this error.
    2. ActiveX Control Registration: The error might also be related to how ActiveX controls are registered on the system where the thumb drive is being used. Ensure that the necessary ActiveX components are properly registered on that machine.
    3. Compatibility Issues: Since you mentioned that the error does not occur in an older version of MS Access, there may be compatibility issues with the newer version of Access when running from a thumb drive. Testing the application on different systems or updating the Access version might help.
    4. Form Design: Review the design of the form to ensure that all controls are properly initialized and that there are no references to null values in the code behind the form.

    If the issue persists, consider checking the error handling in your VBA code to better understand where the null reference is occurring.


    References:

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.