Presumably, clsMold refers to a Class Module of that name. If you do not have such a Class Module in your database, you'd get User Type Not Defined.
Did you find the code somewhere? If so, see if it provides the code for a Class Module clsMold.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am having trouble creating object types in ACCESS VBA. I am using the statement:
Function BuildSQLInsertNewMold(objCurrMold As clsMold) As String
This produces the error User-type Not Defined when I try and compile the Function.
Is there a Reference I need to add in tools>references to be able to do this?
Presumably, clsMold refers to a Class Module of that name. If you do not have such a Class Module in your database, you'd get User Type Not Defined.
Did you find the code somewhere? If so, see if it provides the code for a Class Module clsMold.
Hi @Michael Burden
Thank you for contacting us through the Microsoft Q&A forum.
Based on your description, I understand you're getting a "User-defined type not defined" compile error in Access VBA when using clsMold as a data type in your function's arguments. After reproducing this error in my test environment, I have the following findings.
In your Class Modules, you need to make sure the class's (Name) property is set precisely to clsMold. Consequently, all variable declarations using this object, like in your function, must also reference that exact name. As in the example from my test environment in the image below, please make the changes as shown in the bold blue text.
This is just an example, so please be sure to change the data type name according to your own environment.
If I've misunderstood you, please send me more details about what you want to do. I'll help you to the best of my ability
If you found your answer helpful, click "Accept answer" to upvote it. If you have any other questions about this answer, please click "Comment".
Note: If you want to receive email notifications related to this thread, follow the steps in the documentation to enable email notifications.