2207d VBA Access - Moving parts of a program to DLLs? Error 91.. "Object variable or With block variable not set"
Sign Up |  Live StatsLive Stats    Articles 37,470| Comments 178,656| Members 19,495, Newest singhajay| Online 425
Home Contact
 (Forgotten?): 
    10 years of Excellence
    For best SPN experience, use Firefox Internet Browser!


                                                                   Your Banner Here!    




Click Here to Register/Sign Up Daily Hukamnama Member Blogs Downloads Website Navigation Help Fonts Tags
Sikh Philosophy Network » Sikh Philosophy Network » Current News » Information Technology » VBA Access - Moving parts of a program to DLLs? Error 91.. "Object variable or With block variable not set"

VBA Access - Moving parts of a program to DLLs? Error 91.. "Object variable or With block variable not set"

Our Donation Goal : Why Donate? : Donate Today! : Donate Anonymously (ਗੁਪਤ) : Our Family of Supporters
Goal this month: 500 USD, Received: 0 USD (0%)
Please Donate...
     
Related Topics...
Thread Thread Starter Forum Replies Last Post
"Out of Memory" when trying to output record on one specific variable bradjensmith@gmail.com Information Technology 0 28-Jul-2006 08:16 AM
Using a variable in a "DoCmd" VBA argument George Walsh Information Technology 2 28-Jul-2006 08:09 AM
Error 2448 ("You can't assign a value to this object") cause? Andrew R Information Technology 3 28-Jul-2006 08:08 AM
Object variable or block variable not set Nikki Information Technology 4 28-Jul-2006 08:02 AM
Object Variable or With block variable not set Seren Information Technology 0 28-Jul-2006 08:00 AM


Tags
access, block, dlls, error, moving, object variable or with block variable not set, parts, program, quotobject, setquot, variable, vba
Reply Post New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!
  #1 (permalink)  
Old 28-Jul-2006, 08:39 AM
axs221's Avatar axs221
Guest
 
Posts: n/a
   
   
VBA Access - Moving parts of a program to DLLs? Error 91.. "Object variable or With block variable not set"

  Donate Today!   Email to Friend  Tell a Friend   Show Printable Version  Print   Contact sikhphilosophy.net Administraion for any Suggestions, Ideas, Feedback.  Feedback  

Register to Remove Advertisements
I am trying to move some of our large VBA Access front-end file into
ActiveX DLL files. I created two DLL files so far, one was a module
that contains code to integrate into the QuickBooks accounting
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/information-technology/13730-vba-access-moving-parts-program-dlls.html
software. Another has general utilities.

I tried referencing the utilities dll, and it shows up in the object
explorer. I instantiated an instance of the class and now it shows up
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13730
all okay in the Intellisense. Whenever I try to run a simple function,
though, even a subroutine that just does:

MsgBox "Test"

It gives me the error 91: Object variable or With block variable not
set

Am I missing a step here? We really need these DLLs, or some
alternative, so that we can better use Subversion for our main project.



Do you agree or disagree with the writer above? Why not share your immediate thoughts with us! Login Now! or Sign Up Today! to share your views... Gurfateh!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 28-Jul-2006, 08:39 AM
Norman Yuan's Avatar Norman Yuan
Guest
 
Posts: n/a
   
   
Re: VBA Access - Moving parts of a program to DLLs? Error 91.. "Object variable or With block variable not set"

Yes, you did miss something, for sure, in your code and in your post.
Without seeing your code to show how the routine in the dll is called, there
isn't much to say, except for "the code must be wrong).

"axs221" wrote in message
news:1153516589.043190.20630@i3g2000cwc.googlegrou ps.com...
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13730
>I am trying to move some of our large VBA Access front-end file into
> ActiveX DLL files. I created two DLL files so far, one was a module
> that contains code to integrate into the QuickBooks accounting
> software. Another has general utilities.
>
> I tried referencing the utilities dll, and it shows up in the object
> explorer. I instantiated an instance of the class and now it shows up
> all okay in the Intellisense. Whenever I try to run a simple function,
> though, even a subroutine that just does:
>
> MsgBox "Test"
>
> It gives me the error 91: Object variable or With block variable not
> set
>
> Am I missing a step here? We really need these DLLs, or some
> alternative, so that we can better use Subversion for our main project.
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13730
>



Reply With Quote
  #3 (permalink)  
Old 28-Jul-2006, 08:39 AM
axs221's Avatar axs221
Guest
 
Posts: n/a
   
   
Re: VBA Access - Moving parts of a program to DLLs? Error 91.. "Object variable or With block variable not set"

Basically I created a DLL file, Utilities.dll, and inside it I made a
few classes. One class, lets say AGUtilities, I just wrote a simple
function to test the DLL calls out, like this:

Public Sub MsgBoxTest()
MsgBox "Testing"
End Sub

Then I made a reference to it from our main VBA program.

Dim UtilitiesTest As AGUtilities
AGUtilities.MsgBoxTest

There's a basInitialize that runs at startup. I made a reference to the
DLL in the references menu option, clicking browse and selecting it in
the same directory. I made an instance of the class in that module, and
tried calling the function to run a simple message box, and it gives
that error code. I got the same thing when trying to run another
function before that, one that gets the name of the program running.
The object browser and intillisense looked like any other class but it
just wouldn't run it.

Is there something more that you'd generally need to do in order to run
such a dll call? Where might I be going wrong?

Thanks,

Shawn



Norman Yuan wrote:
> Yes, you did miss something, for sure, in your code and in your post.
> Without seeing your code to show how the routine in the dll is called, there
> isn't much to say, except for "the code must be wrong).
>
> "axs221" wrote in message
> news:1153516589.043190.20630@i3g2000cwc.googlegrou ps.com...
> >I am trying to move some of our large VBA Access front-end file into
> > ActiveX DLL files. I created two DLL files so far, one was a module
> > that contains code to integrate into the QuickBooks accounting
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13730
> > software. Another has general utilities.
> >
> > I tried referencing the utilities dll, and it shows up in the object
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13730
> > explorer. I instantiated an instance of the class and now it shows up
> > all okay in the Intellisense. Whenever I try to run a simple function,
> > though, even a subroutine that just does:
> >
> > MsgBox "Test"
> >
> > It gives me the error 91: Object variable or With block variable not
> > set
> >
> > Am I missing a step here? We really need these DLLs, or some
> > alternative, so that we can better use Subversion for our main project.
> >


Reply With Quote
  #4 (permalink)  
Old 28-Jul-2006, 08:39 AM
Douglas J. Steele's Avatar Douglas J. Steele
Guest
 
Posts: n/a
   
   
Re: VBA Access - Moving parts of a program to DLLs? Error 91.. "Object variable or With block variable not set"

All you've done is indicate what object is supposed to point to the DLL
(through the Dim statement). However, you haven't actually instantiated that
object to make it point to the DLL (using a Set statement):

Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13730
Dim UtilitiesTest As AGUtilities

Set UtilitiesTest = New AGUtilities
AGUtilities.MsgBoxTest


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"axs221" wrote in message
news:1153533480.310317.12690@75g2000cwc.googlegrou ps.com...
> Basically I created a DLL file, Utilities.dll, and inside it I made a
> few classes. One class, lets say AGUtilities, I just wrote a simple
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13730
> function to test the DLL calls out, like this:
>
> Public Sub MsgBoxTest()
> MsgBox "Testing"
> End Sub
>
> Then I made a reference to it from our main VBA program.
>
> Dim UtilitiesTest As AGUtilities
> AGUtilities.MsgBoxTest
>
> There's a basInitialize that runs at startup. I made a reference to the
> DLL in the references menu option, clicking browse and selecting it in
> the same directory. I made an instance of the class in that module, and
> tried calling the function to run a simple message box, and it gives
> that error code. I got the same thing when trying to run another
> function before that, one that gets the name of the program running.
> The object browser and intillisense looked like any other class but it
> just wouldn't run it.
>
> Is there something more that you'd generally need to do in order to run
> such a dll call? Where might I be going wrong?
>
> Thanks,
>
> Shawn
>
>
>
> Norman Yuan wrote:
>> Yes, you did miss something, for sure, in your code and in your post.
>> Without seeing your code to show how the routine in the dll is called,
>> there
>> isn't much to say, except for "the code must be wrong).
>>
>> "axs221" wrote in message
>> news:1153516589.043190.20630@i3g2000cwc.googlegrou ps.com...
>> >I am trying to move some of our large VBA Access front-end file into
>> > ActiveX DLL files. I created two DLL files so far, one was a module
>> > that contains code to integrate into the QuickBooks accounting
>> > software. Another has general utilities.
>> >
>> > I tried referencing the utilities dll, and it shows up in the object
>> > explorer. I instantiated an instance of the class and now it shows up
>> > all okay in the Intellisense. Whenever I try to run a simple function,
>> > though, even a subroutine that just does:
>> >
>> > MsgBox "Test"
>> >
>> > It gives me the error 91: Object variable or With block variable not
>> > set
>> >
>> > Am I missing a step here? We really need these DLLs, or some
>> > alternative, so that we can better use Subversion for our main project.
>> >

>



Reply With Quote
  #5 (permalink)  
Old 28-Jul-2006, 08:39 AM
axs221's Avatar axs221
Guest
 
Posts: n/a
   
   
Re: VBA Access - Moving parts of a program to DLLs? Error 91.. "Object variable or With block variable not set"

I just realized that on someone else's response somewhere else.. I feel
a little silly now. Are we doing things right otherwise, though? Is
putting code into DLLs the best way to split up a large vba access
program? The only annoyance with it I have is that we have to take
functions from modules that were coupled with other modules out and
make another DLL for the new DLLs to reference for the functions they
need. My boss showed me how we link tables the other day in Access. I
wish there was a way to link to external modules or classes, if there
isn't.

Shawn

Douglas J. Steele wrote:
> All you've done is indicate what object is supposed to point to the DLL
> (through the Dim statement). However, you haven't actually instantiated that
> object to make it point to the DLL (using a Set statement):
>
> Dim UtilitiesTest As AGUtilities
>
> Set UtilitiesTest = New AGUtilities
> AGUtilities.MsgBoxTest
>
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13730
> (no private e-mails, please)
>
>
> "axs221" wrote in message
> news:1153533480.310317.12690@75g2000cwc.googlegrou ps.com...
> > Basically I created a DLL file, Utilities.dll, and inside it I made a
> > few classes. One class, lets say AGUtilities, I just wrote a simple
> > function to test the DLL calls out, like this:
> >
> > Public Sub MsgBoxTest()
> > MsgBox "Testing"
> > End Sub
> >
> > Then I made a reference to it from our main VBA program.
> >
> > Dim UtilitiesTest As AGUtilities
> > AGUtilities.MsgBoxTest
> >
> > There's a basInitialize that runs at startup. I made a reference to the
> > DLL in the references menu option, clicking browse and selecting it in
> > the same directory. I made an instance of the class in that module, and
> > tried calling the function to run a simple message box, and it gives
> > that error code. I got the same thing when trying to run another
> > function before that, one that gets the name of the program running.
> > The object browser and intillisense looked like any other class but it
> > just wouldn't run it.
> >
> > Is there something more that you'd generally need to do in order to run
> > such a dll call? Where might I be going wrong?
> >
> > Thanks,
> >
> > Shawn
> >
> >
> >
> > Norman Yuan wrote:
> >> Yes, you did miss something, for sure, in your code and in your post.
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13730
> >> Without seeing your code to show how the routine in the dll is called,
> >> there
> >> isn't much to say, except for "the code must be wrong).
> >>
> >> "axs221" wrote in message
> >> news:1153516589.043190.20630@i3g2000cwc.googlegrou ps.com...
> >> >I am trying to move some of our large VBA Access front-end file into
> >> > ActiveX DLL files. I created two DLL files so far, one was a module
> >> > that contains code to integrate into the QuickBooks accounting
> >> > software. Another has general utilities.
> >> >
> >> > I tried referencing the utilities dll, and it shows up in the object
> >> > explorer. I instantiated an instance of the class and now it shows up
> >> > all okay in the Intellisense. Whenever I try to run a simple function,
> >> > though, even a subroutine that just does:
> >> >
> >> > MsgBox "Test"
> >> >
> >> > It gives me the error 91: Object variable or With block variable not
> >> > set
> >> >
> >> > Am I missing a step here? We really need these DLLs, or some
> >> > alternative, so that we can better use Subversion for our main project.
> >> >

> >


Reply With Quote
  #6 (permalink)  
Old 28-Jul-2006, 08:39 AM
Douglas J. Steele's Avatar Douglas J. Steele
Guest
 
Posts: n/a
   
   
Re: VBA Access - Moving parts of a program to DLLs? Error 91.. "Object variable or With block variable not set"

You can put your code into a library MDB (or MDE), and add a reference to
that library under Tools | References while you're in the VB Editor.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"axs221" wrote in message
news:1153581537.773940.152010@h48g2000cwc.googlegr oups.com...
>I just realized that on someone else's response somewhere else.. I feel
> a little silly now. Are we doing things right otherwise, though? Is
> putting code into DLLs the best way to split up a large vba access
> program? The only annoyance with it I have is that we have to take
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13730
> functions from modules that were coupled with other modules out and
> make another DLL for the new DLLs to reference for the functions they
> need. My boss showed me how we link tables the other day in Access. I
> wish there was a way to link to external modules or classes, if there
> isn't.
>
> Shawn
>
> Douglas J. Steele wrote:
>> All you've done is indicate what object is supposed to point to the DLL
>> (through the Dim statement). However, you haven't actually instantiated
>> that
>> object to make it point to the DLL (using a Set statement):
>>
>> Dim UtilitiesTest As AGUtilities
>>
>> Set UtilitiesTest = New AGUtilities
>> AGUtilities.MsgBoxTest
>>
>>
>> --
>> Doug Steele, Microsoft Access MVP
>> http://I.Am/DougSteele
>> (no private e-mails, please)
>>
>>
>> "axs221" wrote in message
>> news:1153533480.310317.12690@75g2000cwc.googlegrou ps.com...
>> > Basically I created a DLL file, Utilities.dll, and inside it I made a
>> > few classes. One class, lets say AGUtilities, I just wrote a simple
>> > function to test the DLL calls out, like this:
>> >
>> > Public Sub MsgBoxTest()
>> > MsgBox "Testing"
>> > End Sub
>> >
>> > Then I made a reference to it from our main VBA program.
>> >
>> > Dim UtilitiesTest As AGUtilities
>> > AGUtilities.MsgBoxTest
>> >
>> > There's a basInitialize that runs at startup. I made a reference to the
>> > DLL in the references menu option, clicking browse and selecting it in
>> > the same directory. I made an instance of the class in that module, and
>> > tried calling the function to run a simple message box, and it gives
>> > that error code. I got the same thing when trying to run another
>> > function before that, one that gets the name of the program running.
>> > The object browser and intillisense looked like any other class but it
>> > just wouldn't run it.
>> >
>> > Is there something more that you'd generally need to do in order to run
>> > such a dll call? Where might I be going wrong?
>> >
>> > Thanks,
>> >
>> > Shawn
>> >
>> >
>> >
>> > Norman Yuan wrote:
>> >> Yes, you did miss something, for sure, in your code and in your post.
>> >> Without seeing your code to show how the routine in the dll is called,
>> >> there
>> >> isn't much to say, except for "the code must be wrong).
>> >>
>> >> "axs221" wrote in message
>> >> news:1153516589.043190.20630@i3g2000cwc.googlegrou ps.com...
>> >> >I am trying to move some of our large VBA Access front-end file into
>> >> > ActiveX DLL files. I created two DLL files so far, one was a module
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13730
>> >> > that contains code to integrate into the QuickBooks accounting
>> >> > software. Another has general utilities.
>> >> >
>> >> > I tried referencing the utilities dll, and it shows up in the object
>> >> > explorer. I instantiated an instance of the class and now it shows
>> >> > up
>> >> > all okay in the Intellisense. Whenever I try to run a simple
>> >> > function,
>> >> > though, even a subroutine that just does:
>> >> >
>> >> > MsgBox "Test"
>> >> >
>> >> > It gives me the error 91: Object variable or With block variable not
>> >> > set
>> >> >
>> >> > Am I missing a step here? We really need these DLLs, or some
>> >> > alternative, so that we can better use Subversion for our main
>> >> > project.
>> >> >
>> >

>



Reply With Quote
  #7 (permalink)  
Old 28-Jul-2006, 08:40 AM
axs221's Avatar axs221
Guest
 
Posts: n/a
   
   
Re: VBA Access - Moving parts of a program to DLLs? Error 91.. "Object variable or With block variable not set"

Thanks, that might be better. Is there a way to get the separate MDB to
still be able to use function calls from the main front-end file,
though? The only way I know how to do that is to make another database
just for function calls that are used by more than one of the
databases, but that might be a lot of work.

Shawn


Douglas J. Steele wrote:
> You can put your code into a library MDB (or MDE), and add a reference to
> that library under Tools | References while you're in the VB Editor.
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no private e-mails, please)
>
>
> "axs221" wrote in message
> news:1153581537.773940.152010@h48g2000cwc.googlegr oups.com...
> >I just realized that on someone else's response somewhere else.. I feel
> > a little silly now. Are we doing things right otherwise, though? Is
> > putting code into DLLs the best way to split up a large vba access
> > program? The only annoyance with it I have is that we have to take
> > functions from modules that were coupled with other modules out and
> > make another DLL for the new DLLs to reference for the functions they
> > need. My boss showed me how we link tables the other day in Access. I
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13730
> > wish there was a way to link to external modules or classes, if there
> > isn't.
> >
> > Shawn
> >
> > Douglas J. Steele wrote:
> >> All you've done is indicate what object is supposed to point to the DLL
> >> (through the Dim statement). However, you haven't actually instantiated
> >> that
> >> object to make it point to the DLL (using a Set statement):
> >>
> >> Dim UtilitiesTest As AGUtilities
> >>
> >> Set UtilitiesTest = New AGUtilities
> >> AGUtilities.MsgBoxTest
> >>
> >>
> >> --
> >> Doug Steele, Microsoft Access MVP
> >> http://I.Am/DougSteele
> >> (no private e-mails, please)
> >>
> >>
> >> "axs221" wrote in message
> >> news:1153533480.310317.12690@75g2000cwc.googlegrou ps.com...
> >> > Basically I created a DLL file, Utilities.dll, and inside it I made a
> >> > few classes. One class, lets say AGUtilities, I just wrote a simple
> >> > function to test the DLL calls out, like this:
> >> >
> >> > Public Sub MsgBoxTest()
> >> > MsgBox "Testing"
> >> > End Sub
> >> >
> >> > Then I made a reference to it from our main VBA program.
> >> >
> >> > Dim UtilitiesTest As AGUtilities
> >> > AGUtilities.MsgBoxTest
> >> >
> >> > There's a basInitialize that runs at startup. I made a reference to the
> >> > DLL in the references menu option, clicking browse and selecting it in
> >> > the same directory. I made an instance of the class in that module, and
> >> > tried calling the function to run a simple message box, and it gives
> >> > that error code. I got the same thing when trying to run another
> >> > function before that, one that gets the name of the program running.
> >> > The object browser and intillisense looked like any other class but it
> >> > just wouldn't run it.
> >> >
> >> > Is there something more that you'd generally need to do in order to run
> >> > such a dll call? Where might I be going wrong?
> >> >
> >> > Thanks,
> >> >
> >> > Shawn
> >> >
> >> >
> >> >
> >> > Norman Yuan wrote:
> >> >> Yes, you did miss something, for sure, in your code and in your post.
> >> >> Without seeing your code to show how the routine in the dll is called,
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13730
> >> >> there
> >> >> isn't much to say, except for "the code must be wrong).
> >> >>
> >> >> "axs221" wrote in message
> >> >> news:1153516589.043190.20630@i3g2000cwc.googlegrou ps.com...
> >> >> >I am trying to move some of our large VBA Access front-end file into
> >> >> > ActiveX DLL files. I created two DLL files so far, one was a module
> >> >> > that contains code to integrate into the QuickBooks accounting
> >> >> > software. Another has general utilities.
> >> >> >
> >> >> > I tried referencing the utilities dll, and it shows up in the object
> >> >> > explorer. I instantiated an instance of the class and now it shows
> >> >> > up
> >> >> > all okay in the Intellisense. Whenever I try to run a simple
> >> >> > function,
> >> >> > though, even a subroutine that just does:
> >> >> >
> >> >> > MsgBox "Test"
> >> >> >
> >> >> > It gives me the error 91: Object variable or With block variable not
> >> >> > set
> >> >> >
> >> >> > Am I missing a step here? We really need these DLLs, or some
> >> >> > alternative, so that we can better use Subversion for our main
> >> >> > project.
> >> >> >
> >> >

> >


Reply With Quote
  #8 (permalink)  
Old 28-Jul-2006, 08:40 AM
axs221's Avatar axs221
Guest
 
Posts: n/a
   
   
Re: VBA Access - Moving parts of a program to DLLs? Error 91.. "Object variable or With block variable not set"

Well, not just functions, but we also need queries and a few global
variables and a few other things we have in our main program.

We have a few global variables that set the name and location of some
other files in initialization, along with a few other ones, but the new
MDB file I created can't access them when referenced. It won't let me
reference back to the main database, of course, it gives a cyclical
reference error.

Is there a way to have a seperate database referenced but have it act
like one database? It seems like there should be an easy way to do
that, to make things more modular...

Shawn

axs221 wrote:
> Thanks, that might be better. Is there a way to get the separate MDB to
> still be able to use function calls from the main front-end file,
> though? The only way I know how to do that is to make another database
> just for function calls that are used by more than one of the
> databases, but that might be a lot of work.
>
> Shawn
>
>
> Douglas J. Steele wrote:
> > You can put your code into a library MDB (or MDE), and add a reference to
> > that library under Tools | References while you're in the VB Editor.
> >
> > --
> > Doug Steele, Microsoft Access MVP
> > http://I.Am/DougSteele
> > (no private e-mails, please)
> >
> >
> > "axs221" wrote in message
> > news:1153581537.773940.152010@h48g2000cwc.googlegr oups.com...
> > >I just realized that on someone else's response somewhere else.. I feel
> > > a little silly now. Are we doing things right otherwise, though? Is
> > > putting code into DLLs the best way to split up a large vba access
> > > program? The only annoyance with it I have is that we have to take
> > > functions from modules that were coupled with other modules out and
> > > make another DLL for the new DLLs to reference for the functions they
> > > need. My boss showed me how we link tables the other day in Access. I
> > > wish there was a way to link to external modules or classes, if there
> > > isn't.
> > >
> > > Shawn
> > >
> > > Douglas J. Steele wrote:
> > >> All you've done is indicate what object is supposed to point to the DLL
> > >> (through the Dim statement). However, you haven't actually instantiated
> > >> that
> > >> object to make it point to the DLL (using a Set statement):
> > >>
> > >> Dim UtilitiesTest As AGUtilities
> > >>
> > >> Set UtilitiesTest = New AGUtilities
> > >> AGUtilities.MsgBoxTest
> > >>
> > >>
> > >> --
> > >> Doug Steele, Microsoft Access MVP
> > >> http://I.Am/DougSteele
> > >> (no private e-mails, please)
> > >>
> > >>
> > >> "axs221" wrote in message
> > >> news:1153533480.310317.12690@75g2000cwc.googlegrou ps.com...
> > >> > Basically I created a DLL file, Utilities.dll, and inside it I made a
> > >> > few classes. One class, lets say AGUtilities, I just wrote a simple
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13730
> > >> > function to test the DLL calls out, like this:
> > >> >
> > >> > Public Sub MsgBoxTest()
> > >> > MsgBox "Testing"
> > >> > End Sub
> > >> >
> > >> > Then I made a reference to it from our main VBA program.
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13730
> > >> >
> > >> > Dim UtilitiesTest As AGUtilities
> > >> > AGUtilities.MsgBoxTest
> > >> >
> > >> > There's a basInitialize that runs at startup. I made a reference to the
> > >> > DLL in the references menu option, clicking browse and selecting it in
> > >> > the same directory. I made an instance of the class in that module, and
> > >> > tried calling the function to run a simple message box, and it gives
> > >> > that error code. I got the same thing when trying to run another
> > >> > function before that, one that gets the name of the program running.
> > >> > The object browser and intillisense looked like any other class but it
> > >> > just wouldn't run it.
> > >> >
> > >> > Is there something more that you'd generally need to do in order to run
> > >> > such a dll call? Where might I be going wrong?
> > >> >
> > >> > Thanks,
> > >> >
> > >> > Shawn
> > >> >
> > >> >
> > >> >
> > >> > Norman Yuan wrote:
> > >> >> Yes, you did miss something, for sure, in your code and in your post.
> > >> >> Without seeing your code to show how the routine in the dll is called,
> > >> >> there
> > >> >> isn't much to say, except for "the code must be wrong).
> > >> >>
> > >> >> "axs221" wrote in message
> > >> >> news:1153516589.043190.20630@i3g2000cwc.googlegrou ps.com...
> > >> >> >I am trying to move some of our large VBA Access front-end file into
> > >> >> > ActiveX DLL files. I created two DLL files so far, one was a module
> > >> >> > that contains code to integrate into the QuickBooks accounting
> > >> >> > software. Another has general utilities.
> > >> >> >
> > >> >> > I tried referencing the utilities dll, and it shows up in the object
> > >> >> > explorer. I instantiated an instance of the class and now it shows
> > >> >> > up
> > >> >> > all okay in the Intellisense. Whenever I try to run a simple
> > >> >> > function,
> > >> >> > though, even a subroutine that just does:
> > >> >> >
> > >> >> > MsgBox "Test"
> > >> >> >
> > >> >> > It gives me the error 91: Object variable or With block variable not
> > >> >> > set
> > >> >> >
> > >> >> > Am I missing a step here? We really need these DLLs, or some
> > >> >> > alternative, so that we can better use Subversion for our main
> > >> >> > project.
> > >> >> >
> > >> >
> > >


Reply With Quote
  #9 (permalink)  
Old 28-Jul-2006, 08:40 AM
Douglas J. Steele's Avatar Douglas J. Steele
Guest
 
Posts: n/a
   
   
Re: VBA Access - Moving parts of a program to DLLs? Error 91.. "Object variable or With block variable not set"

  Donate Today!  
Not sure I understand your question.

If, in Database A you set a reference to Database B, within Database A you
can call functions from Database B. Database B, however, won't know anything
about functions in Database A.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"axs221" wrote in message
news:1153752396.944194.20280@i3g2000cwc.googlegrou ps.com...
> Thanks, that might be better. Is there a way to get the separate MDB to
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13730
> still be able to use function calls from the main front-end file,
> though? The only way I know how to do that is to make another database
> just for function calls that are used by more than one of the
> databases, but that might be a lot of work.
>
> Shawn
>
>
> Douglas J. Steele wrote:
>> You can put your code into a library MDB (or MDE), and add a reference to
>> that library under Tools | References while you're in the VB Editor.
>>
>> --
>> Doug Steele, Microsoft Access MVP
>> http://I.Am/DougSteele
>> (no private e-mails, please)
>>
>>
>> "axs221" wrote in message
>> news:1153581537.773940.152010@h48g2000cwc.googlegr oups.com...
>> >I just realized that on someone else's response somewhere else.. I feel
>> > a little silly now. Are we doing things right otherwise, though? Is
>> > putting code into DLLs the best way to split up a large vba access
>> > program? The only annoyance with it I have is that we have to take
>> > functions from modules that were coupled with other modules out and
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13730
>> > make another DLL for the new DLLs to reference for the functions they
>> > need. My boss showed me how we link tables the other day in Access. I
>> > wish there was a way to link to external modules or classes, if there
>> > isn't.
>> >
>> > Shawn
>> >
>> > Douglas J. Steele wrote:
>> >> All you've done is indicate what object is supposed to point to the
>> >> DLL
>> >> (through the Dim statement). However, you haven't actually
>> >> instantiated
>> >> that
>> >> object to make it point to the DLL (using a Set statement):
>> >>
>> >> Dim UtilitiesTest As AGUtilities
>> >>
>> >> Set UtilitiesTest = New AGUtilities
>> >> AGUtilities.MsgBoxTest
>> >>
>> >>
>> >> --
>> >> Doug Steele, Microsoft Access MVP
>> >> http://I.Am/DougSteele
>> >> (no private e-mails, please)
>> >>
>> >>
>> >> "axs221" wrote in message
>> >> news:1153533480.310317.12690@75g2000cwc.googlegrou ps.com...
>> >> > Basically I created a DLL file, Utilities.dll, and inside it I made
>> >> > a
>> >> > few classes. One class, lets say AGUtilities, I just wrote a simple
>> >> > function to test the DLL calls out, like this:
>> >> >
>> >> > Public Sub MsgBoxTest()
>> >> > MsgBox "Testing"
>> >> > End Sub
>> >> >
>> >> > Then I made a reference to it from our main VBA program.
>> >> >
>> >> > Dim UtilitiesTest As AGUtilities
>> >> > AGUtilities.MsgBoxTest
>> >> >
>> >> > There's a basInitialize that runs at startup. I made a reference to
>> >> > the
>> >> > DLL in the references menu option, clicking browse and selecting it
>> >> > in
>> >> > the same directory. I made an instance of the class in that module,
>> >> > and
>> >> > tried calling the function to run a simple message box, and it gives
>> >> > that error code. I got the same thing when trying to run another
>> >> > function before that, one that gets the name of the program running.
>> >> > The object browser and intillisense looked like any other class but
>> >> > it
>> >> > just wouldn't run it.
>> >> >
>> >> > Is there something more that you'd generally need to do in order to
>> >> > run
>> >> > such a dll call? Where might I be going wrong?
>> >> >
>> >> > Thanks,
>> >> >
>> >> > Shawn
>> >> >
>> >> >
>> >> >
>> >> > Norman Yuan wrote:
>> >> >> Yes, you did miss something, for sure, in your code and in your
>> >> >> post.
>> >> >> Without seeing your code to show how the routine in the dll is
>> >> >> called,
>> >> >> there
>> >> >> isn't much to say, except for "the code must be wrong).
>> >> >>
>> >> >> "axs221" wrote in message
>> >> >> news:1153516589.043190.20630@i3g2000cwc.googlegrou ps.com...
>> >> >> >I am trying to move some of our large VBA Access front-end file
>> >> >> >into
>> >> >> > ActiveX DLL files. I created two DLL files so far, one was a
>> >> >> > module
>> >> >> > that contains code to integrate into the QuickBooks accounting
>> >> >> > software. Another has general utilities.
>> >> >> >
>> >> >> > I tried referencing the utilities dll, and it shows up in the
>> >> >> > object
>> >> >> > explorer. I instantiated an instance of the class and now it
>> >> >> > shows
>> >> >> > up
>> >> >> > all okay in the Intellisense. Whenever I try to run a simple
>> >> >> > function,
>> >> >> > though, even a subroutine that just does:
>> >> >> >
>> >> >> > MsgBox "Test"
>> >> >> >
>> >> >> > It gives me the error 91: Object variable or With block variable
>> >> >> > not
>> >> >> > set
>> >> >> >
>> >> >> > Am I missing a step here? We really need these DLLs, or some
>> >> >> > alternative, so that we can better use Subversion for our main
>> >> >> > project.
>> >> >> >
>> >> >
>> >

>



Reply With Quote
   Click Here to Donate Now!

Support Us!
Become a Promoter!
Gurfateh ji, you can become a SPN Promoter by Donating as little as $10 each month. With limited resources & high operational costs, your donations make it possible for us to deliver a quality website and spread the teachings of the Sri Guru Granth Sahib Ji, to serve & uplift humanity. Every contribution counts. Donate Generously. Gurfateh!
ReplyPost New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!

Bookmarks


(View-All Members who have read this thread : 0
There are no names to display.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Tools Search
Search:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

» Active Discussions
Thought of the Moment!
Today 00:06 AM
116 Replies, 6,101 Views
English Sri Guru Granth Sahib Ji Translations
Yesterday 23:30 PM
6 Replies, 88 Views
Can Sikhs worship...
Yesterday 23:17 PM
15 Replies, 156 Views
Sikh Philosophy Network...
Yesterday 22:26 PM
16 Replies, 765 Views
Sikh Spokesman (ਪੰਜਾਬੀ...
Yesterday 21:25 PM
256 Replies, 6,069 Views
Difference in Bowing...
By Kamala
Yesterday 15:08 PM
11 Replies, 260 Views
What Really Happened on...
Yesterday 12:46 PM
13 Replies, 222 Views
Free Online Gurbani...
Yesterday 03:56 AM
13 Replies, 4,339 Views
English Sri Guru Granth...
Yesterday 03:51 AM
5 Replies, 171 Views
Edward Snowden: the...
Yesterday 03:34 AM
3 Replies, 186 Views
Rozana Reports (ਪੰਜਾਬੀ...
Yesterday 03:23 AM
407 Replies, 9,442 Views
What Is Difference...
18-Jun-2013 09:18 AM
6 Replies, 183 Views
First There is Water by...
By Ishna
18-Jun-2013 05:03 AM
3 Replies, 192 Views
Cooking Without Alcohol
18-Jun-2013 02:12 AM
12 Replies, 203 Views
Learning from Baba...
18-Jun-2013 01:38 AM
0 Replies, 312 Views
» Books You Should Read...
Powered by vBadvanced CMPS v3.2.3
All times are GMT +6.5. The time now is 00:56 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2 Copyright © 2004-12, All Rights Reserved. Sikh Philosophy Network


Page generated in 1.03798 seconds with 32 queries
0