I want to pass that "pointer" to another form. Using openargs and
passing a string, then using Me.Tag to pass back a string has become
very clumsy. Since OpenArgs is actually a variant there must be a
better way. Altough I can set one global collection and pass thru that
I would rather just pass a pointer around.
I think it was Bill Gates himself who decided that VB and VBA would
not support pointers ... the "ObjPtr" thing was a kludge invented to
provide a work-around for the limitations (at the time) of the COM
object model.
Every variant has a subtype ... internally, a variant in VBA is
implemented as a C union. I can't point you to a reference for this,
but I believe it is adequately documented somewhere (others: please
feel free to pitch in with links!) Therefore, it is not possible to
simply assign one variant to another without some intermedient
"compiler magic" (or interpreter magic, in the case of VBA).
Have you considered custom database properties? Check out the help
file topic for the Properties collection and the Property attribute.
If we grant that you could somehow do what you propose (i.e. using
pointers), and you would be doing it as indicated by your short
example code, then you would need to consider the lifetime of the
object you are passing around. It looks to me like you NEED to have a
global object (because after you leave the procedure where you have
defined the Collection object, its lifetime would be undefined).