I get an error message on the .Add LINE ("only user-defined types defined in public object modules can be coerced to or from a variant or passed to late-bound functions")
Dim myPriority As typPriority 'In module CustomTypes
Dim colPriority As New Collection
.........
Do While Not rs.EOF
myPriority.Code = rs.Fields("Code").Value
myPriority.Desc = rs.Fields("Desc").Value
colPriority.Add myPriority <==== Error here
Loop
------- definition of type --------
Public Type typPriority
Code As String
Desc As String
End Type
Dim myPriority As typPriority 'In module CustomTypes
Dim colPriority As New Collection
.........
Do While Not rs.EOF
myPriority.Code = rs.Fields("Code").Value
myPriority.Desc = rs.Fields("Desc").Value
colPriority.Add myPriority <==== Error here
Loop
------- definition of type --------
Public Type typPriority
Code As String
Desc As String
End Type