John W. Colby
jwcolby at colbyconsulting.com
Sun Mar 21 13:27:06 CST 2004
Has anyone ever succeeded in storing a custom data type in a collection? I
get an error message:
"Compile error
Only user defined types defined in public object modules can be coerced to
or from a variant or passed to late bound functions."
This is the code I'm using:
Public Type TblDat
strCnn As adodb.Connection
strTblName As String
End Type
Public colTest As Collection
Public Function SVTblDat(lstrCnn As adodb.Connection, lstrTblName As String)
As TblDat
Dim lTblDat As TblDat
Set lTblDat.strCnn = lstrCnn
lTblDat.strTblName = lstrTblName
SVTblDat = lTblDat
End Function
Public Function TestCollection()
Set colTest = New Collection
colTest.Add SVTblDat(CurrentProject.Connection, "1234")
End Function
Calling TestCollection and the error highlights SVTblDat(
Anyone?
John W. Colby
www.ColbyConsulting.com