The creation and customization of database applications using Microsoft Access
Hi Doug,
- Import DLL from Tools-> Reference ->browse -> select FM20.DLL from C:\Windows\System32.
Thanks
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Dim MyData As DataObject produces this error:
Is there a Reference to a dll required?
The creation and customization of database applications using Microsoft Access
Hi Doug,
Thanks
Hello Doug
From my experience, for DataObject, the required library is Microsoft Forms 2.0 Object Library (FM20.dll).
Please press Alt + F11 to open the VBA editor, then go to Tools > References and scroll through the list until you find Microsoft Forms 2.0 Object Library. Check the box next to it and click OK.
In case you cannot find it, you can click Browse..., then navigate to locations such as C:\Windows\System32\, C:\Windows\SysWOW64\, or other system folders, and look for a file named FM20.DLL. Select it and click Open.
Hope this information helps. If the issue persists, could you please upload your file to OneDrive and share it with me via private message so I can take a closer look?
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.
AI answer
Yes, a reference is required.
In VBA, DataObject is not a built‑in type; it is defined in an external library. When Dim MyData As DataObject produces “User-defined type not defined”, it means the class is in a DLL/assembly that is not referenced by the project.
To resolve this, add a reference to the library that defines DataObject (for example, the appropriate Office/InfoPath or other object library that exposes the DataObject interface). This aligns with the general rule that when a base class or type is defined in an external assembly, that assembly must be added as a reference so the compiler can find the type.
References: