PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
Run time error '91'-VBForums
Results 1 to 15 of 15

Thread: Run time error '91'

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2006
    Posts
    14

    Question Run time error '91'

    Hey there

    I am currently experiencing a run time error with my project and seeking advise on what to do in this regard. The run time error is:

    Run-time error "91"
    object variable or With Block variable not set

    If anyone can assist I would highly appreciate it. I am trying to run my application from a remote PC.

  2. #2
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    Re: Run time error '91'

    Show us the code where it is happening. You are referencing an object that has not been set yet.

  3. #3
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: Run time error '91'

    As posted show us the code.

    Usually this error happens when you are trying to using an uninitialized object. Something like this
    VB Code:
    1. Dim accessCon As ADODB.COnnection
    2. 'this line will throw an error
    3. AccessCon.ConnectionString = "......"
    Use [code] source code here[/code] tags when you post source code.

    My Articles

  4. #4

    Thread Starter
    New Member
    Join Date
    Apr 2006
    Posts
    14

    Re: Run time error '91'

    The thing is when I play the application where the development is being done the error does not show but when I make it to be an .exe and try to play it after downloading it, it gives me the error.

    Remember I am trying to access it from remote/other workstations. Any ideas????? please..........

  5. #5
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: Run time error '91'

    You must atleast have an Idea which function is throwing this error. Try to check what that function does and see if you can pinpoint the error.

    The problem here is that we cannot help unless we see the code or exact description of the problem.
    Use [code] source code here[/code] tags when you post source code.

    My Articles

  6. #6
    Lively Member
    Join Date
    Mar 2006
    Posts
    94

    Re: Run time error '91'

    You have to SET the object too.

    Dim accessCon As ADODB.COnnection
    SET accessCon = New ADODB.COnnection

    or

    Dim accessCon As New ADODB.COnnection <- not recommended because of memory leaking problems.


    AccessCon.ConnectionString = "......"

    Edited to correct a stupid quoting mistake...
    Last edited by King_George; Jun 22nd, 2006 at 12:12 PM.
    Energy can be neither created not destroyed. It can only be wasted.

    Red Green

  7. #7
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: Run time error '91'

    Quote Originally Posted by King_George
    You have to SET the object too.

    Dim accessCon As ADODB.COnnection
    SET accessCon = New ADODB.COnnection

    or

    Dim accessCon As New ADODB.COnnection <- not recommended because of memory leaking problems.


    AccessCon.ConnectionString = "......"
    What was that for?
    Use [code] source code here[/code] tags when you post source code.

    My Articles

  8. #8
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,692

    Re: Run time error '91'

    Are you just copying the .exe file to the other computer, or are you copying the installation package and installing the whole application?
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  9. #9
    Lively Member
    Join Date
    Mar 2006
    Posts
    94

    Re: Run time error '91'

    Quote Originally Posted by Shuja Ali
    What was that for?
    OOPS... I'll edit that...sorry
    Energy can be neither created not destroyed. It can only be wasted.

    Red Green

  10. #10
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,612

    Re: Run time error '91'

    Quote Originally Posted by King_George
    You have to SET the object too.

    Dim accessCon As ADODB.COnnection
    SET accessCon = New ADODB.COnnection

    or

    Dim accessCon As New ADODB.COnnection <- not recommended because of memory leaking problems.


    AccessCon.ConnectionString = "......"

    Edited to correct a stupid quoting mistake...
    King, actually I suspected the same.
    But shouldn't it give error in IDE too

    Pradeep
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." Charles F. Kettering

    Read articles on My Blog 101 LINQ Samples JSON Validator XML Schema Validator "How Do I" videos on MSDN VB.NET and C# Comparison Good Coding Practices VBForums Reputation Saver String Enum Super Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  11. #11
    Lively Member
    Join Date
    Mar 2006
    Posts
    94

    Re: Run time error '91'

    Quote Originally Posted by Pradeep1210
    King, actually I suspected the same.
    But shouldn't it give error in IDE too

    Pradeep
    Not always. You probably do not have Option Explicit turned on. As a note, ALWAYS have this at the top of each form module and you'll never get this type of error.

    Remember the IDE is different that a runtime environment.
    Energy can be neither created not destroyed. It can only be wasted.

    Red Green

  12. #12

    Thread Starter
    New Member
    Join Date
    Apr 2006
    Posts
    14

    Re: Run time error '91'

    To answer AL42, I am downloading the application from a server into another workstation that doesn't have VB6....

  13. #13
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: Run time error '91'

    You still need to install the application for it to work correctly.

  14. #14
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,692

    Re: Run time error '91'

    What randem said - you can't just copy files with a program written in VB.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  15. #15

    Thread Starter
    New Member
    Join Date
    Apr 2006
    Posts
    14

    Re: Run time error '91'

    I seem to have figured what the problem is, its the ADODC connection that I'm using cause with the ADODB connection method the application seems to work. Now my question is, is there a way of solving this or will I have to use the adodb connection outrite. If so can some one let me know of how I can connect a datagrid using the ADODB method.

    Thanks in advance..............

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width