Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-access > #11967 > unrolled thread

Code library and classes

Started byinternet.shopping@foobox.com
First post2016-08-15 12:04 -0700
Last post2016-08-17 21:06 +0100
Articles 6 — 3 participants

Back to article view | Back to comp.databases.ms-access


Contents

  Code library and classes internet.shopping@foobox.com - 2016-08-15 12:04 -0700
    Re: Code library and classes "Stuart McCall" <smccall@myunrealbox.com> - 2016-08-15 23:04 +0100
      Re: Code library and classes internet.shopping@foobox.com - 2016-08-16 07:11 -0700
        Re: Code library and classes Mike P <mikewpayne@tiscali.co.uk> - 2016-08-17 06:50 -0700
          Re: Code library and classes internet.shopping@foobox.com - 2016-08-18 04:44 -0700
        Re: Code library and classes "Stuart McCall" <smccall@myunrealbox.com> - 2016-08-17 21:06 +0100

#11967 — Code library and classes

Frominternet.shopping@foobox.com
Date2016-08-15 12:04 -0700
SubjectCode library and classes
Message-ID<d6fdbb09-d4e1-4fb5-a404-51bb3a0e3cf6@googlegroups.com>
I trying to set up an .accdb code library to use with a number of programs.  Not sure why I haven't done this years ago!

Is it possible to define classes in a code library for use in the main database?  I am having a problem with it at the moment.

Jim

[toc] | [next] | [standalone]


#11968

From"Stuart McCall" <smccall@myunrealbox.com>
Date2016-08-15 23:04 +0100
Message-ID<note9p$1kd8$1@gioia.aioe.org>
In reply to#11967
<internet.shopping@foobox.com> wrote in message 
news:d6fdbb09-d4e1-4fb5-a404-51bb3a0e3cf6@googlegroups.com...
>I trying to set up an .accdb code library to use with a number of programs. 
>Not sure why I haven't done this years ago!
>
> Is it possible to define classes in a code library for use in the main 
> database?  I am having a problem with it at the moment.
>
> Jim

You could set up a public function in the ACCDB that returns a new class 
object:

Public Function New_Thing1() As ClassName
    Set New_Thing1 = New ClassName
End Function

[toc] | [prev] | [next] | [standalone]


#11969

Frominternet.shopping@foobox.com
Date2016-08-16 07:11 -0700
Message-ID<fa49e5ab-1c96-46e4-8728-02b3fa6a744f@googlegroups.com>
In reply to#11968
On Monday, 15 August 2016 23:04:47 UTC+1, Stuart McCall  wrote:
> <internet.shopping@foobox.com> wrote in message 
> news:d6fdbb09-d4e1-4fb5-a404-51bb3a0e3cf6@googlegroups.com...
> >I trying to set up an .accdb code library to use with a number of programs. 
> >Not sure why I haven't done this years ago!
> >
> > Is it possible to define classes in a code library for use in the main 
> > database?  I am having a problem with it at the moment.
> >
> > Jim
> 
> You could set up a public function in the ACCDB that returns a new class 
> object:
> 
> Public Function New_Thing1() As ClassName
>     Set New_Thing1 = New ClassName
> End Function

Looks promising but I am having a problem with it.

In my code library I have

Public Function theWebClient() As WebClient
    Set theWebClient = New WebClient
End Function

However when I put

    Dim ApiPostClient As Object
    Set ApiPostClient = theWebClient()

in my main database I get the error:
Sub or function not defined.

Both the main database and the code library are in the same directory (folder).

Am I missing some magic to enable the one part to see the other?

I am adding this to some an existing library where other existing functions show up correctly.



[toc] | [prev] | [next] | [standalone]


#11976

FromMike P <mikewpayne@tiscali.co.uk>
Date2016-08-17 06:50 -0700
Message-ID<25693be2-808d-464a-972a-8fc0ea014e51@googlegroups.com>
In reply to#11969
On Tuesday, August 16, 2016 at 3:11:04 PM UTC+1, internet...@foobox.com wrote:
> On Monday, 15 August 2016 23:04:47 UTC+1, Stuart McCall  wrote:
> > <internet.shopping@foobox.com> wrote in message 
> > news:d6fdbb09-d4e1-4fb5-a404-51bb3a0e3cf6@googlegroups.com...
> > >I trying to set up an .accdb code library to use with a number of programs. 
> > >Not sure why I haven't done this years ago!
> > >
> > > Is it possible to define classes in a code library for use in the main 
> > > database?  I am having a problem with it at the moment.
> > >
> > > Jim
> > 
> > You could set up a public function in the ACCDB that returns a new class 
> > object:
> > 
> > Public Function New_Thing1() As ClassName
> >     Set New_Thing1 = New ClassName
> > End Function
> 
> Looks promising but I am having a problem with it.
> 
> In my code library I have
> 
> Public Function theWebClient() As WebClient
>     Set theWebClient = New WebClient
> End Function
> 
> However when I put
> 
>     Dim ApiPostClient As Object
>     Set ApiPostClient = theWebClient()
> 
> in my main database I get the error:
> Sub or function not defined.
> 
> Both the main database and the code library are in the same directory (folder).
> 
> Am I missing some magic to enable the one part to see the other?
> 
> I am adding this to some an existing library where other existing functions show up correctly.

Hi Have you created a reference to the code library in Tools > References in the IDE (integrated development environment)?

Mike P.

17/8/16

[toc] | [prev] | [next] | [standalone]


#11980

Frominternet.shopping@foobox.com
Date2016-08-18 04:44 -0700
Message-ID<2f456c65-91f5-4409-ba89-53a68c0e1d1e@googlegroups.com>
In reply to#11976
On Wednesday, 17 August 2016 14:50:36 UTC+1, Mike P  wrote:
> On Tuesday, August 16, 2016 at 3:11:04 PM UTC+1, internet...@foobox.com wrote:
> > On Monday, 15 August 2016 23:04:47 UTC+1, Stuart McCall  wrote:
> > > <internet.shopping@foobox.com> wrote in message 
> > > news:d6fdbb09-d4e1-4fb5-a404-51bb3a0e3cf6@googlegroups.com...
> > > >I trying to set up an .accdb code library to use with a number of programs. 
> > > >Not sure why I haven't done this years ago!
> > > >
> > > > Is it possible to define classes in a code library for use in the main 
> > > > database?  I am having a problem with it at the moment.
> > > >
> > > > Jim
> > > 
> > > You could set up a public function in the ACCDB that returns a new class 
> > > object:
> > > 
> > > Public Function New_Thing1() As ClassName
> > >     Set New_Thing1 = New ClassName
> > > End Function
> > 
> > Looks promising but I am having a problem with it.
> > 
> > In my code library I have
> > 
> > Public Function theWebClient() As WebClient
> >     Set theWebClient = New WebClient
> > End Function
> > 
> > However when I put
> > 
> >     Dim ApiPostClient As Object
> >     Set ApiPostClient = theWebClient()
> > 
> > in my main database I get the error:
> > Sub or function not defined.
> > 
> > Both the main database and the code library are in the same directory (folder).
> > 
> > Am I missing some magic to enable the one part to see the other?
> > 
> > I am adding this to some an existing library where other existing functions show up correctly.
> 
> Hi Have you created a reference to the code library in Tools > References in the IDE (integrated development environment)?
> 
> Mike P.
> 
> 17/8/16

Thanks Mike.  I should have posted earlier to say that I had worked it out and it is working well.

Thanks to all for the contributions.

Jim

[toc] | [prev] | [next] | [standalone]


#11978

From"Stuart McCall" <smccall@myunrealbox.com>
Date2016-08-17 21:06 +0100
Message-ID<np2g3n$bfg$1@gioia.aioe.org>
In reply to#11969
<internet.shopping@foobox.com> wrote in message 
news:fa49e5ab-1c96-46e4-8728-02b3fa6a744f@googlegroups.com...
> On Monday, 15 August 2016 23:04:47 UTC+1, Stuart McCall  wrote:
>> <internet.shopping@foobox.com> wrote in message
>> news:d6fdbb09-d4e1-4fb5-a404-51bb3a0e3cf6@googlegroups.com...
>> >I trying to set up an .accdb code library to use with a number of 
>> >programs.
>> >Not sure why I haven't done this years ago!
>> >
>> > Is it possible to define classes in a code library for use in the main
>> > database?  I am having a problem with it at the moment.
>> >
>> > Jim
>>
>> You could set up a public function in the ACCDB that returns a new class
>> object:
>>
>> Public Function New_Thing1() As ClassName
>>     Set New_Thing1 = New ClassName
>> End Function
>
> Looks promising but I am having a problem with it.
>
> In my code library I have
>
> Public Function theWebClient() As WebClient
>    Set theWebClient = New WebClient
> End Function
>
> However when I put
>
>    Dim ApiPostClient As Object
>    Set ApiPostClient = theWebClient()
>
> in my main database I get the error:
> Sub or function not defined.
>
> Both the main database and the code library are in the same directory 
> (folder).
>
> Am I missing some magic to enable the one part to see the other?
>
> I am adding this to some an existing library where other existing 
> functions show up correctly.

Well the last time I worked in Access was 10 years ago. A2003 was the last 
version I used, and the method I described always worked with that and 
previous versions. A reference was not required because the library was in 
the same folder (as you have it).

Don't know why it's not working for you. Perhaps someone with experience of 
later  Access versions may be able to help.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.databases.ms-access


csiph-web