Share via

DataObject object reference for MS Access

Doug 25 Reputation points
2026-05-19T13:47:55.22+00:00

What reference library should I use to define DataObject in VBA code for MS Access project?

Microsoft 365 and Office | Access | Development
0 comments No comments

2 answers

Sort by: Most helpful
  1. Jayden-P 22,390 Reputation points Microsoft External Staff Moderator
    2026-05-19T14:23:03.34+00:00

    Hi @Doug

    To use the DataObject type in an MS Access VBA project, you need to reference the Microsoft Forms 2.0 Object Library, because DataObject is not part of native VBA and is instead provided by the MSForms library. Without this reference, you’ll get “User-defined type not defined” when declaring an object.

    To do this Go to Tools > References > Browse then navigate to locations such as C:\Windows\System32, C:\Windows\SysWOW64, and look for a file named FM20.DLL then open it.

    I hope this information helps.


    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.

    Was this answer helpful?


  2. AI answer

    2026-05-19T13:48:03.8633333+00:00

    Use the Microsoft Forms 2.0 Object Library reference.

    In an Access VBA project, add it like any other reference:

    1. Open any module.
    2. Go to Tools → References….
    3. Check Microsoft Forms 2.0 Object Library.
    4. Click OK.

    After that, DataObject is available (from Microsoft.Vbe.Interop.Forms) and can be used in code.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

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.