What is wrong with this code ?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
"object module" = class module

AFAIK, if typPriority were a Class (or if it was "from" a Class?), you could
add instances of it to a collection. But if it isn't a built-in type, or
created from a Class module, no.

HTH,
 
Back
Top