Fix User-Defined Type Not Defined in Access Form Events
Question details
Resolve a user-defined type error affecting form event procedures in a converted Access database.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- An older MDB database has been converted, and the user needs its form event procedures to work.
- Observed behavior
- Access reports “User-defined type not defined” when form event procedures are opened, even if the procedures contain simple commands.
Make a copy of the database before changing references or repairing code. Note the name of any reference marked MISSING so you can identify or replace the library if the project depends on it.
Check VBA references and compile the Access project
Use this approach first when a converted database reports a type error across form event procedures.
Open the database in Access and press Alt+F11 to open the Visual Basic Editor.
In the editor, select Tools > References. Note any library marked MISSING, then clear its checkbox if it is unavailable or no longer needed.
In Tools > References, select an installed compatible library or use Browse to locate it if the project still depends on the missing reference. Check the library's documentation for compatibility with your Access installation.
Select Debug > Compile in the VBA editor. Inspect any highlighted declaration and correct its type or reference, then compile again until the project compiles without errors.

Verify and repair the affected form event procedures
Check the form's event settings and code if errors remain after fixing references and declarations.
Work with Office documents in WPS Office
WPS Office is a free, lightweight alternative for everyday document, spreadsheet, and presentation work. Its familiar interface and Office format support help you move compatible files between suites. It does not repair Access VBA references or replace an Access database application.

Frequently Asked Questions
Why does a simple Access form event trigger a type error?
VBA may encounter a missing reference or an invalid declaration elsewhere in the project. Open the VBA editor and select Debug > Compile to find the declaration that needs attention.
Where can I find missing VBA references?
Press Alt+F11 in Access, then select Tools > References. Look for libraries marked MISSING and identify whether the project needs a compatible replacement.
How do I connect a form event to its VBA procedure?
Open the form in Design View, select the form or control, and open the Property Sheet. On the Event tab, set the relevant event to [Event Procedure] and click the ellipsis button to open its code.
Will WPS Office fix an Access VBA reference error?
No. Fix the references and code in Microsoft Access. WPS Office can be used separately for compatible Office documents and spreadsheets, but it does not replace an Access database application.




