Runtime 424: Object Required on form.Show

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Matt Nunnally
    New Member
    • Jul 2007
    • 56

    Runtime 424: Object Required on form.Show

    I have two forms and a module. The module has a method in which it calls a function in Form1. Within that function, I call form2.show (vbmodal) and I get this runtime error. Its driving me nuts. What am could be causing this?

    I also call form1.show vbmodal later on in that method of the module. That one has no problems.

    Any help would be extremely appreciated.
  • kadghar
    Recognized Expert Top Contributor
    • Apr 2007
    • 1302

    #2
    Originally posted by Matt Nunnally
    I have two forms and a module. The module has a method in which it calls a function in Form1. Within that function, I call form2.show (vbmodal) and I get this runtime error. Its driving me nuts. What am could be causing this?

    I also call form1.show vbmodal later on in that method of the module. That one has no problems.

    Any help would be extremely appreciated.
    it depends on the version of VB you are using, but i think this would work almost in every desk application. lets say you have in form1 something like

    [CODE=vb]public function CallF2()
    form2.show
    end function[/CODE]

    and then you have in your module something like:

    [CODE=vb]sub OpenF2()
    form1.callf2
    end sub[/CODE]

    and lets say you call the OpenF2 from a command on form1

    [CODE=vb]private sub command1_click( )
    openf2
    end sub[/CODE]

    This should show form2 when you click the command1

    hope that helps

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      Originally posted by Matt Nunnally
      I have two forms and a module. The module has a method in which it calls a function in Form1. Within that function, I call form2.show (vbmodal) and I get this runtime error. Its driving me nuts. What am could be causing this?

      I also call form1.show vbmodal later on in that method of the module. That one has no problems.
      Are you sure you didn't just mistype the name of form2 or something?

      Sorry if this sounds like a stupid beginner-oriented question, but it's surprising how often the really simple errors can trip you up. In fact, I'll even go so far as to mention here to beware that the Name of the form is not necessarily the same as the name of the form file. In other words, what is saved as form2 could be known to VB as "frmSomeMeaning fulName". (At least in VB6 this is the case - don't know about later versions.)

      Comment

      • Matt Nunnally
        New Member
        • Jul 2007
        • 56

        #4
        It was something stupid. The form itself had nothing to do with it. It was an object in the code on that form that wasn't declared correctly. In fact it was my logging object, which is what was leading me to believe that it was the form's fault since I wasn't seeing any logging.
        Thanks for the help

        Comment

        • Killer42
          Recognized Expert Expert
          • Oct 2006
          • 8429

          #5
          Originally posted by Matt Nunnally
          It was something stupid. The form itself had nothing to do with it. It was an object in the code on that form that wasn't declared correctly. In fact it was my logging object, which is what was leading me to believe that it was the form's fault since I wasn't seeing any logging.
          Thanks for the help
          Glad to see it's sorted.

          I think it's important to remember, when debugging, that the problem is often what you assume it can't be.

          Comment

          Working...