Why is This Undefined?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Wayne Wengert

    #1

    Why is This Undefined?

    I am trying to create a Sub in a VS 2005 project but the parameter being
    passed comes up with an error of "Undefined" within the sub? I am including
    the Sub header and the point of the error. I am lost as to why this fails?


    Wayne


    =============== ======= Code Snippets ==============
    Public Sub SetupRecap(ByRe f recaptype As
    CrystalDecision s.CrystalReport s.Engine.Report Document)

    ............... ........

    crReport = New recaptype '<=== recaptype is flagged as undefined?

    ............... ........

    End Sub


  • CT

    #2
    Re: Why is This Undefined?

    Wayne,

    recaptype is a variable, an instance of the type
    CrystalDecision s.CrystalReport s.Engine.Report Document. If recaptype is
    instantiated when it is passed to SetupRecap, you can simpyl use it as is,
    i.e. recaptype.xxxxP roperty = ""

    --
    Carsten Thomsen
    Communities - http://community.integratedsolutions.dk

    "Wayne Wengert" <wayneSKIPSPAM@ wengert.org> wrote in message
    news:Oz6J2DK0FH A.3896@TK2MSFTN GP10.phx.gbl...[color=blue]
    >I am trying to create a Sub in a VS 2005 project but the parameter being
    >passed comes up with an error of "Undefined" within the sub? I am including
    >the Sub header and the point of the error. I am lost as to why this fails?
    >
    >
    > Wayne
    >
    >
    > =============== ======= Code Snippets ==============
    > Public Sub SetupRecap(ByRe f recaptype As
    > CrystalDecision s.CrystalReport s.Engine.Report Document)
    >
    > ............... .......
    >
    > crReport = New recaptype '<=== recaptype is flagged as
    > undefined?
    >
    > ............... .......
    >
    > End Sub
    >
    >[/color]


    Comment

    • Wayne Wengert

      #3
      Re: Why is This Undefined?

      Carsten;

      Thanks for that information. You are right in that when I removed the "New"
      the error msg went away. I just can't seem to get OO right!

      Wayne

      "CT" <carstent@spamm ersgoawayintegr asol.dk> wrote in message
      news:eqJxHWK0FH A.3640@TK2MSFTN GP10.phx.gbl...[color=blue]
      > Wayne,
      >
      > recaptype is a variable, an instance of the type
      > CrystalDecision s.CrystalReport s.Engine.Report Document. If recaptype is
      > instantiated when it is passed to SetupRecap, you can simpyl use it as is,
      > i.e. recaptype.xxxxP roperty = ""
      >
      > --
      > Carsten Thomsen
      > Communities - http://community.integratedsolutions.dk
      >
      > "Wayne Wengert" <wayneSKIPSPAM@ wengert.org> wrote in message
      > news:Oz6J2DK0FH A.3896@TK2MSFTN GP10.phx.gbl...[color=green]
      >>I am trying to create a Sub in a VS 2005 project but the parameter being
      >>passed comes up with an error of "Undefined" within the sub? I am
      >>including the Sub header and the point of the error. I am lost as to why
      >>this fails?
      >>
      >>
      >> Wayne
      >>
      >>
      >> =============== ======= Code Snippets ==============
      >> Public Sub SetupRecap(ByRe f recaptype As
      >> CrystalDecision s.CrystalReport s.Engine.Report Document)
      >>
      >> ............... .......
      >>
      >> crReport = New recaptype '<=== recaptype is flagged as
      >> undefined?
      >>
      >> ............... .......
      >>
      >> End Sub
      >>
      >>[/color]
      >
      >[/color]


      Comment

      • CT

        #4
        Re: Why is This Undefined?

        Wayne,

        You don't even need the "crReport = recaptype", just use recaptype as you
        would use crReport. You simple have two variables poiting to the same
        object, if not.

        --
        Carsten Thomsen
        Communities - http://community.integratedsolutions.dk

        "Wayne Wengert" <wayneSKIPSPAM@ wengert.org> wrote in message
        news:uMVx5tK0FH A.1256@TK2MSFTN GP09.phx.gbl...[color=blue]
        > Carsten;
        >
        > Thanks for that information. You are right in that when I removed the
        > "New" the error msg went away. I just can't seem to get OO right!
        >
        > Wayne
        >
        > "CT" <carstent@spamm ersgoawayintegr asol.dk> wrote in message
        > news:eqJxHWK0FH A.3640@TK2MSFTN GP10.phx.gbl...[color=green]
        >> Wayne,
        >>
        >> recaptype is a variable, an instance of the type
        >> CrystalDecision s.CrystalReport s.Engine.Report Document. If recaptype is
        >> instantiated when it is passed to SetupRecap, you can simpyl use it as
        >> is, i.e. recaptype.xxxxP roperty = ""
        >>
        >> --
        >> Carsten Thomsen
        >> Communities - http://community.integratedsolutions.dk
        >>
        >> "Wayne Wengert" <wayneSKIPSPAM@ wengert.org> wrote in message
        >> news:Oz6J2DK0FH A.3896@TK2MSFTN GP10.phx.gbl...[color=darkred]
        >>>I am trying to create a Sub in a VS 2005 project but the parameter being
        >>>passed comes up with an error of "Undefined" within the sub? I am
        >>>including the Sub header and the point of the error. I am lost as to why
        >>>this fails?
        >>>
        >>>
        >>> Wayne
        >>>
        >>>
        >>> =============== ======= Code Snippets ==============
        >>> Public Sub SetupRecap(ByRe f recaptype As
        >>> CrystalDecision s.CrystalReport s.Engine.Report Document)
        >>>
        >>> ............... .......
        >>>
        >>> crReport = New recaptype '<=== recaptype is flagged as
        >>> undefined?
        >>>
        >>> ............... .......
        >>>
        >>> End Sub
        >>>
        >>>[/color]
        >>
        >>[/color]
        >
        >[/color]


        Comment

        • Wayne Wengert

          #5
          Re: Why is This Undefined?

          Carsten;

          Thanks for the additional information. I assign that to crReport as that is
          the common report name used in my preview routine. I have several processes
          that populate various reports and they all end up calling the preview form
          which uses a global crReport as the base.

          Wayne

          "CT" <carstent@spamm ersgoawayintegr asol.dk> wrote in message
          news:OYJBixK0FH A.2540@TK2MSFTN GP09.phx.gbl...[color=blue]
          > Wayne,
          >
          > You don't even need the "crReport = recaptype", just use recaptype as you
          > would use crReport. You simple have two variables poiting to the same
          > object, if not.
          >
          > --
          > Carsten Thomsen
          > Communities - http://community.integratedsolutions.dk
          >
          > "Wayne Wengert" <wayneSKIPSPAM@ wengert.org> wrote in message
          > news:uMVx5tK0FH A.1256@TK2MSFTN GP09.phx.gbl...[color=green]
          >> Carsten;
          >>
          >> Thanks for that information. You are right in that when I removed the
          >> "New" the error msg went away. I just can't seem to get OO right!
          >>
          >> Wayne
          >>
          >> "CT" <carstent@spamm ersgoawayintegr asol.dk> wrote in message
          >> news:eqJxHWK0FH A.3640@TK2MSFTN GP10.phx.gbl...[color=darkred]
          >>> Wayne,
          >>>
          >>> recaptype is a variable, an instance of the type
          >>> CrystalDecision s.CrystalReport s.Engine.Report Document. If recaptype is
          >>> instantiated when it is passed to SetupRecap, you can simpyl use it as
          >>> is, i.e. recaptype.xxxxP roperty = ""
          >>>
          >>> --
          >>> Carsten Thomsen
          >>> Communities - http://community.integratedsolutions.dk
          >>>
          >>> "Wayne Wengert" <wayneSKIPSPAM@ wengert.org> wrote in message
          >>> news:Oz6J2DK0FH A.3896@TK2MSFTN GP10.phx.gbl...
          >>>>I am trying to create a Sub in a VS 2005 project but the parameter being
          >>>>passed comes up with an error of "Undefined" within the sub? I am
          >>>>including the Sub header and the point of the error. I am lost as to why
          >>>>this fails?
          >>>>
          >>>>
          >>>> Wayne
          >>>>
          >>>>
          >>>> =============== ======= Code Snippets ==============
          >>>> Public Sub SetupRecap(ByRe f recaptype As
          >>>> CrystalDecision s.CrystalReport s.Engine.Report Document)
          >>>>
          >>>> ............... .......
          >>>>
          >>>> crReport = New recaptype '<=== recaptype is flagged as
          >>>> undefined?
          >>>>
          >>>> ............... .......
          >>>>
          >>>> End Sub
          >>>>
          >>>>
          >>>
          >>>[/color]
          >>
          >>[/color]
          >
          >[/color]


          Comment

          • CT

            #6
            Re: Why is This Undefined?

            Ah... ;-)

            --
            Carsten Thomsen
            Communities - http://community.integratedsolutions.dk

            "Wayne Wengert" <wayneSKIPSPAM@ wengert.org> wrote in message
            news:e45WlEL0FH A.720@TK2MSFTNG P15.phx.gbl...[color=blue]
            > Carsten;
            >
            > Thanks for the additional information. I assign that to crReport as that
            > is the common report name used in my preview routine. I have several
            > processes that populate various reports and they all end up calling the
            > preview form which uses a global crReport as the base.
            >
            > Wayne
            >
            > "CT" <carstent@spamm ersgoawayintegr asol.dk> wrote in message
            > news:OYJBixK0FH A.2540@TK2MSFTN GP09.phx.gbl...[color=green]
            >> Wayne,
            >>
            >> You don't even need the "crReport = recaptype", just use recaptype as you
            >> would use crReport. You simple have two variables poiting to the same
            >> object, if not.
            >>
            >> --
            >> Carsten Thomsen
            >> Communities - http://community.integratedsolutions.dk
            >>
            >> "Wayne Wengert" <wayneSKIPSPAM@ wengert.org> wrote in message
            >> news:uMVx5tK0FH A.1256@TK2MSFTN GP09.phx.gbl...[color=darkred]
            >>> Carsten;
            >>>
            >>> Thanks for that information. You are right in that when I removed the
            >>> "New" the error msg went away. I just can't seem to get OO right!
            >>>
            >>> Wayne
            >>>
            >>> "CT" <carstent@spamm ersgoawayintegr asol.dk> wrote in message
            >>> news:eqJxHWK0FH A.3640@TK2MSFTN GP10.phx.gbl...
            >>>> Wayne,
            >>>>
            >>>> recaptype is a variable, an instance of the type
            >>>> CrystalDecision s.CrystalReport s.Engine.Report Document. If recaptype is
            >>>> instantiated when it is passed to SetupRecap, you can simpyl use it as
            >>>> is, i.e. recaptype.xxxxP roperty = ""
            >>>>
            >>>> --
            >>>> Carsten Thomsen
            >>>> Communities - http://community.integratedsolutions.dk
            >>>>
            >>>> "Wayne Wengert" <wayneSKIPSPAM@ wengert.org> wrote in message
            >>>> news:Oz6J2DK0FH A.3896@TK2MSFTN GP10.phx.gbl...
            >>>>>I am trying to create a Sub in a VS 2005 project but the parameter
            >>>>>being passed comes up with an error of "Undefined" within the sub? I am
            >>>>>includin g the Sub header and the point of the error. I am lost as to
            >>>>>why this fails?
            >>>>>
            >>>>>
            >>>>> Wayne
            >>>>>
            >>>>>
            >>>>> =============== ======= Code Snippets ==============
            >>>>> Public Sub SetupRecap(ByRe f recaptype As
            >>>>> CrystalDecision s.CrystalReport s.Engine.Report Document)
            >>>>>
            >>>>> ............... .......
            >>>>>
            >>>>> crReport = New recaptype '<=== recaptype is flagged as
            >>>>> undefined?
            >>>>>
            >>>>> ............... .......
            >>>>>
            >>>>> End Sub
            >>>>>
            >>>>>
            >>>>
            >>>>
            >>>
            >>>[/color]
            >>
            >>[/color]
            >
            >[/color]


            Comment

            • Herfried K. Wagner [MVP]

              #7
              Re: Why is This Undefined?

              "Wayne Wengert" <wayneSKIPSPAM@ wengert.org> schrieb:[color=blue]
              >I am trying to create a Sub in a VS 2005 project but the parameter being
              >passed comes up with an error of "Undefined" within the sub? I am including
              >the Sub header and the point of the error. I am lost as to why this fails?
              >
              > =============== ======= Code Snippets ==============
              > Public Sub SetupRecap(ByRe f recaptype As
              > CrystalDecision s.CrystalReport s.Engine.Report Document)
              >
              > ............... .......
              >
              > crReport = New recaptype '<=== recaptype is flagged as
              > undefined?[/color]

              If you want to make 'crReport' reference the same object as 'recaptype':

              \\\
              crReport = recaptype
              ///

              'recaptype' is a variable and thus cannot be used as a type in the scenario
              you describe above.

              If you want to create a new instance of 'ReportDocument ':

              \\\
              crRepoirt = New CrystalDecision s.CrystalReport s.Engine.Report Document(...)
              ///

              --
              M S Herfried K. Wagner
              M V P <URL:http://dotnet.mvps.org/>
              V B <URL:http://classicvb.org/petition/>

              Comment

              Working...