Reference a Class

G

Guest

Win Xp SP2 - Access 2003

I use a library database (compiled as mde) with code and classes. There is a
class named clsAny (declared Publicnotcreatable in properties class)

I reference the library in other mdb. When i instanciated a class from the
library:

Dim MyObj as library.clsAny
Set MyObj= New library.clsAny

.... allways gets an error, the code d'ont compile, ...

Is posible to reference a class in a mdb from a library database?

(It runs in the same library, but no when i do it from another mdb.)
Thanks
 
K

Keith Wilby

ToniMaura said:
Win Xp SP2 - Access 2003

I use a library database (compiled as mde) with code and classes. There is
a
class named clsAny (declared Publicnotcreatable in properties class)

I reference the library in other mdb. When i instanciated a class from the
library:

Dim MyObj as library.clsAny
Set MyObj= New library.clsAny

... allways gets an error, the code d'ont compile, ...

Is posible to reference a class in a mdb from a library database?

(It runs in the same library, but no when i do it from another mdb.)
Thanks

Never tried it myself but what error do you get? Does it compile if you use

Dim MyObj as clsAny
Set MyObj= New clsAny

?

Keith.
www.keithwilby.com
 
S

Stefan Hoffmann

hi Toni,
Is posible to reference a class in a mdb from a library database?
Use a factory method:

Option Compare Database
Option Explicit

Public Sub test()

Dim ca As NGlib.clsAny

Set ca = NGlib.NewAny

Set ca = Nothing

End Sub

in your library:

clsAny:
Option Compare Database
Option Explicit

Private Sub Class_Initialize()

On Local Error Resume Next

MsgBox "Class_Initialize()", vbInformation + vbOKOnly, "NGlib"

End Sub

module AnyFactory:
Option Compare Database
Option Explicit

Public Function NewAny() As clsAny

Set NewAny = New clsAny

End Function


One line link:
http://groups.google.com/group/micr...s+library+class&rnum=3&hl=de#e95d9739761a7ef0


mfG
--> stefan <--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top