The creation and customization of database applications using Microsoft Access
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: