Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User Defined Types and Collections

Status
Not open for further replies.

steveouthwaite

Programmer
Feb 12, 2003
165
GB
Hi,

I am trying to store some data in a collection.

What I want is to access the info such as:
a = collection (index).name
b = collection (index).cat1

I have set a variable to a User Defined Type, assigned the data, then added this to the collection



In a module...

Public type riskassessment_type
name as string
cat1 as string
cat2 as string
End type

public ra_temp as riskassessment_type

public riskassessment_collection as new collection


in a form...

ra_temp.name = "test1"
ra_temp.cat1 = "testcat1"
ra_temp.cat2 = "testcat2"

riskassessment_collection.add ratemp,ra_temp.name


an error is generated at "riskassessment_collection.add..."

"only user defined types defined in public object modules can be coerced to or from a variant or passed to late-bound functions."

Unfortunately MSDN just repeats that error message.

Anyone know what's going on?

thanks in advance,


Steve


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top