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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi, that's what I did : decla

Status
Not open for further replies.

fheyn

Programmer
Mar 22, 2001
198
DE
Hi,

that's what I did :

declared in module :

Type tagRec
....
End Type

Public Rec0 as tagRec

on Form-Load :

Rec0 = MyFunc(...) where MyFunc return VARIANT

now it gives me a message like this :

You attempted to use a public user defined type as a parameter or return type for a public procedure of a class module, or as a field of a public user defined type. Only public user defined types that are defined in a public object module can be used in this manner.

what does it mean with "public object module"

any help welcome
 
If you are doing this in a Class Module you need to make it private (i.e Only the class can interact with your type), You may want it this way, you may not, hoever if you want it to work with a form you need to use a .bas file. Unless of course you set up accessors (get, set)

Public means accesible to "object" i.e. a form. It refers to accessbility. Public, Private, Friend. If you are not familiar with these concepts I suggest you look into some OO concepts. Anyway to get it work just create a Module, not a class module, and it will work for you.

Good luck.
 
thanks for your answer rorubin.

But I did define the TYPE as well as declare the variable in a .bas-module ('cause I don't have much experience with
cls-modules)

if I say
Public Rec as Variant

and on Form-Load :

Rec = MyFunc(...) where MyFunc return VARIANT
all goes fine.
but as soon as I say

Rec0 = Rec

it gives the same error message.


 
Just a shot in the dark, but how about:

Public Type tagRec

See if that works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top