Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312

    Unanswered: Use Class Module in Another Database

    What I am trying to do is to create a Progress Meter class. It's a class I created in a Class Module that uses a custom form and a progress meter control. The problem I am running into is that I would like to use it in several databases. So I would like to save it in Database A (which is an all code database) set a reference to it in Database B and be able to instantiate it in Database B. When I do that, it seems like my only two choices are 1-Private and 2-PublicNotCreatable. Can anyone help me figure out how to be able to use my class in more than one database?

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    instantiate the class indirectly via a 'class provider' function

    in your library 'DCKlibrary' set the class module publicNotCreatable.

    add a normal (not class!!) module in the library db to provide the class(es). the provider goes something like:

    public function makeDCKprogMeter() as DCKprogMeter 'assuming your class is DCKprogMeter
    set makeDCKprogMeter = new DCKprogMeter
    end function



    to instantiate your class from some other db:

    dim progmeter1 as DCKlibrary.DCKprogMeter
    set progmeter1 = DCKlibrary.makeDCKprogMeter



    progmeter1 now has the attributes of your class.

    izy
    Last edited by izyrider; 05-17-06 at 03:43.
    currently using SS 2008R2

  3. #3
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    That is exactly what I was looking for. I could have spent several hours trying to figure that one out. I probably would have ended up with several copies of the class module in each database. Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •