Page 4 of 4 FirstFirst 1234
Results 121 to 144 of 144

Thread: [RESOLVED] Runtime error '91': Object variable or with block not set

  1. #121
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: [RESOLVED] Runtime error '91': Object variable or with block not set

    I improved my little sample app that displays the message form only when the user wants to see it. I also added some more comments.
    Attached Files Attached Files

  2. #122

    Thread Starter
    Addicted Member
    Join Date
    Jul 2011
    Posts
    139

    Re: [RESOLVED] Runtime error '91': Object variable or with block not set

    Ok. Thanks alot.

  3. #123

    Thread Starter
    Addicted Member
    Join Date
    Jul 2011
    Posts
    139

    Re: [RESOLVED] Runtime error '91': Object variable or with block not set

    On this code you gave me I set the control color at Focus time to the below but I want a situation when the Focus time out the colour should also. How do I go about that, Thanks.
    Code:
    Public Sub Flash(ctl As Control)
    
        Dim dblClock As Double
        Dim lngCount As Long
        
        For lngCount = 1 To 6 ' If you change the 6, make sure it's an even number
            dblClock = Timer
            
            ' Pause .25 seconds
            While Timer < dblClock + 0.25
                DoEvents
            Wend
            ctl.Visible = Not ctl.Visible
        Next
       ctl.SetFocus
       
    vb Code:
    1. ctl.BackColor = &H80000013
    End Sub

  4. #124
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: [RESOLVED] Runtime error '91': Object variable or with block not set

    Seriously, you should get some sleep.

    To answer your question however, you could move the ctl.SetFocus to just before the For/Next loop and set a color right after that and set another color when the For/Next is done.

  5. #125

    Thread Starter
    Addicted Member
    Join Date
    Jul 2011
    Posts
    139

    Re: [RESOLVED] Runtime error '91': Object variable or with block not set

    Quote Originally Posted by MartinLiss View Post
    Seriously, you should get some sleep.

    To answer your question however, you could move the ctl.SetFocus to just before the For/Next loop and set a color right after that and set another color when the For/Next is done.
    Lol. Yeah I will. Not met my target yet. Thanks for the infor.
    Last edited by Ehwenomare; Jul 28th, 2011 at 10:55 PM. Reason: error

  6. #126
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: [RESOLVED] Runtime error '91': Object variable or with block not set

    Good morning. I've attached a revised CPSystems form. If you want to try it, save a copy of your current CPSystems form first.
    Attached Files Attached Files

  7. #127

    Thread Starter
    Addicted Member
    Join Date
    Jul 2011
    Posts
    139

    Re: [RESOLVED] Runtime error '91': Object variable or with block not set

    OK. Thanks

  8. #128

    Thread Starter
    Addicted Member
    Join Date
    Jul 2011
    Posts
    139

    Re: [RESOLVED] Runtime error '91': Object variable or with block not set

    Quote Originally Posted by MartinLiss View Post
    Seriously, you should get some sleep.

    To answer your question however, you could move the ctl.SetFocus to just before the For/Next loop and set a color right after that and set another color when the For/Next is done.
    Quote Originally Posted by MartinLiss View Post
    Good morning. I've attached a revised CPSystems form. If you want to try it, save a copy of your current CPSystems form first.
    That thing looks something else. It seems you want my supervisor to make me a suspect. Please details of the properties that makes that thing look like an apple PC is required, Thanks

  9. #129

    Thread Starter
    Addicted Member
    Join Date
    Jul 2011
    Posts
    139

    Re: [RESOLVED] Runtime error '91': Object variable or with block not set

    I can now see the usefulness of the array properties. Thanks

  10. #130

    Thread Starter
    Addicted Member
    Join Date
    Jul 2011
    Posts
    139

    Re: [RESOLVED] Runtime error '91': Object variable or with block not set

    It seems you work for MS or apple. You are GENIUS. Thanks for sharing the knowledge at no cost. Experiment #4 works so good. I'm loving it. Thanks

  11. #131
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: [RESOLVED] Runtime error '91': Object variable or with block not set

    Thanks, it was pretty straightforward using a control array of command buttons and a frame control. Anything else is in the code. Have you used control arrays before?

    Did you notice the change in wording from "Computer simulation for…" and "...part 1 and 2" to "Computer simulation of…" and "...parts 1 and 2"?

  12. #132

    Thread Starter
    Addicted Member
    Join Date
    Jul 2011
    Posts
    139

    Re: [RESOLVED] Runtime error '91': Object variable or with block not set

    Please give me a clue to what I am not doing wrong here. If i click on the "NO" option the form vanishes. very annoying. Thanks.
    Code:
    Private Sub cmdcancel_Click()
     MsgBox "Are you sure you want to exit program", vbQuestion + vbYesNo, "Confirm"
        Unload Me
    End Sub
    Last edited by Ehwenomare; Jul 29th, 2011 at 12:10 PM. Reason: error

  13. #133
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: [RESOLVED] Runtime error '91': Object variable or with block not set

    Quote Originally Posted by Ehwenomare View Post
    It seems you work for MS or apple. You are GENIUS. Thanks for sharing the knowledge at no cost. Experiment #4 works so good. I'm loving it. Thanks
    I'm 70 so my working days are long since over but I appreciate the compliment. Also if you've considered buying a MAC of some sort but you didn't do it because you thought that you couldn't run VB on it, you can. I use an iMAC with a piece of software called Parallels which allows me to run a Windows session side by side with the iMAC's Lion OS. It's seamless. I can run VB in the windows session and transfer files between the two, etcetera.

  14. #134

    Thread Starter
    Addicted Member
    Join Date
    Jul 2011
    Posts
    139

    Re: [RESOLVED] Runtime error '91': Object variable or with block not set

    Quote Originally Posted by MartinLiss View Post
    Thanks, it was pretty straightforward using a control array of command buttons and a frame control. Anything else is in the code. Have you used control arrays before?

    Did you notice the change in wording from "Computer simulation for…" and "...part 1 and 2" to "Computer simulation of…" and "...parts 1 and 2"?
    To hell with whatever that thing says. It has been trashed into the recycle bin. Thanks.

  15. #135

    Thread Starter
    Addicted Member
    Join Date
    Jul 2011
    Posts
    139

    Re: [RESOLVED] Runtime error '91': Object variable or with block not set

    Quote Originally Posted by Ehwenomare View Post
    To hell with whatever that thing says. It has been trashed into the recycle bin. Thanks.
    I try avoiding it. Never understood it's usefulness until now.

  16. #136
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: [RESOLVED] Runtime error '91': Object variable or with block not set

    Code:
    Private Sub cmdcancel_Click()
     MsgBox "Are you sure you want to exit program", vbQuestion + vbYesNo, "Confirm"
        Unload Me
    End Sub
    You need to query the user's response as you did here
    Code:
    If MsgBox("Is this the most economical alternative?", vbQuestion + vbYesNo, "Confirm") = vbYes Then
    BTW you never did answer my question which was how does the user know that this is the most economical alternative?

  17. #137

    Thread Starter
    Addicted Member
    Join Date
    Jul 2011
    Posts
    139

    Re: [RESOLVED] Runtime error '91': Object variable or with block not set

    Quote Originally Posted by MartinLiss View Post
    Code:
    Private Sub cmdcancel_Click()
     MsgBox "Are you sure you want to exit program", vbQuestion + vbYesNo, "Confirm"
        Unload Me
    End Sub
    You need to query the user's response as you did here
    Code:
    If MsgBox("Is this the most economical alternative?", vbQuestion + vbYesNo, "Confirm") = vbYes Then
    BTW you never did answer my question which was how does the user know that this is the most economical alternative?
    I thought I have already in an earlier post. It is a choice the user has to make. It has to do with the cost. I mean the life cycle costing of implementing the system. Whether, if it's gonna be cheaper to do an impressed current protection of the pipeline or a sacrificial anode protection of the pipeline. It is a cost comparison which the client or the operator of the pipeline has to consider. He enters all the costing for the different stages of the project: meaning total cost at design, operation, decommissioning etc and compares the two values giving the scope of the project and other factors ecetera, ecetera. Hope it's clear this way.

  18. #138

    Thread Starter
    Addicted Member
    Join Date
    Jul 2011
    Posts
    139

    Re: [RESOLVED] Runtime error '91': Object variable or with block not set

    Quote Originally Posted by Ehwenomare View Post
    I thought I have already in an earlier post. It is a choice the user has to make. It has to do with the cost. I mean the life cycle costing of implementing the system. Whether, if it's gonna be cheaper to do an impressed current protection of the pipeline or a sacrificial anode protection of the pipeline. It is a cost comparison which the client or the operator of the pipeline has to consider. He enters all the costing for the different stages of the project: meaning total cost at design, operation, decommissioning etc and compares the two values giving the scope of the project and other factors ecetera, ecetera. Hope it's clear this way.
    I did that but still has same problem. Maybe I try it out again. Thanks

  19. #139
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: [RESOLVED] Runtime error '91': Object variable or with block not set

    I only gave the "as you did here" as an example of how it's done. If you look ad the two pieces of code you'll see that the latter one starts with an If and compares the result to vbYes. So what you should do is

    Code:
    Private Sub cmdcancel_Click()
     If MsgBox ("Are you sure you want to exit program", vbQuestion + vbYesNo, "Confirm") = vbYes Then
        Unload Me
    End If
    End Sub
    BTW unless I misunderstand what you were saying in your last post you should have been able to figure that out.

  20. #140

    Thread Starter
    Addicted Member
    Join Date
    Jul 2011
    Posts
    139

    Re: [RESOLVED] Runtime error '91': Object variable or with block not set

    Quote Originally Posted by MartinLiss View Post
    I'm 70 so my working days are long since over but I appreciate the compliment. Also if you've considered buying a MAC of some sort but you didn't do it because you thought that you couldn't run VB on it, you can. I use an iMAC with a piece of software called Parallels which allows me to run a Windows session side by side with the iMAC's Lion OS. It's seamless. I can run VB in the windows session and transfer files between the two, etcetera.
    But I believe you'r very proud at your achievement. You are still very strong and agile like a youth. Your old age doesn't count. You are an ocean of knowledge, a grand master in the act. That's a good infor. I'll try it someday when bored with this Toshiba.

  21. #141

    Thread Starter
    Addicted Member
    Join Date
    Jul 2011
    Posts
    139

    Re: [RESOLVED] Runtime error '91': Object variable or with block not set

    Quote Originally Posted by MartinLiss View Post
    I only gave the "as you did here" as an example of how it's done. If you look ad the two pieces of code you'll see that the latter one starts with an If and compares the result to vbYes. So what you should do is

    Code:
    Private Sub cmdcancel_Click()
     If MsgBox ("Are you sure you want to exit program", vbQuestion + vbYesNo, "Confirm") = vbYes Then
        Unload Me
    End If
    End Sub
    BTW unless I misunderstand what you were saying in your last post you should have been able to figure that out.
    Thanks. Resolved.

  22. #142
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: [RESOLVED] Runtime error '91': Object variable or with block not set

    You may have fixed this by now but I just noticed that in onshoresystems.Form_Load you fill cbocoating and cboanodename twice. More importantly you never refer to the data for either one.

  23. #143
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: [RESOLVED] Runtime error '91': Object variable or with block not set

    Another bug.

    Code:
    Private Sub cbocpstype_Click()
        If (cbocpstype.Text = "Impressed Current") Then
            FrameImpressedCurrent.Visible = True
            FrameSacrificialCurrent.Visible = False
            Framelifecycleanalysis.Visible = True
            offshorecpsystems.Height = 10845
            cmdcancelform.Visible = False
        Else
                FrameImpressedCurrent.Visible = False
                FrameSacrificialCurrent.Visible = True
                Framelifecycleanalysis.Visible = True
                offshorecpsystems.Height = 10845
                cmdcancelform.Visible = False
                Your If/Else structure is wrong and you only get here if cbocpstype.Text = "Impressed Current"
                If (cbocpstype.Text = "") Then
                    FrameImpressedCurrent.Visible = False
                    FrameSacrificialCurrent.Visible = False
                    offshorecpsystems.Height = 4500
                    cmdcancelform.Visible = True
                End If
            End If
        
    
    End Sub

  24. #144
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: [RESOLVED] Runtime error '91': Object variable or with block not set

    Just a suggestion:

    since this thread has long been resolved I don't think members will benefit from it's "going, and going, and going...". I'm pretty positive that original question has been answered and maybe it's time to split this thread into several smaller "stand alone" threads each with distinct title.

Page 4 of 4 FirstFirst 1234

Posting Permissions

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



Click Here to Expand Forum to Full Width