Assigning a Variable OpenArgs

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

    Assigning a Variable OpenArgs

    Hi am having difficulty understanding why the following is not
    working.

    Dim TempID As Integer
    Set TempID = Me.OpenArgs

    Knowing that OpenArgs is a string I then changed the declaration of
    TempID to be String, but this does not work either.

    I have also tried

    Set TempID = Val(OpenArgs) 'where TempID is an integer.

    Can anyone suggest possible solutions. I need the value of OpenArgs
    to be copied this TempID variale as I need it for a particular
    programming purpose.

    Thanks
  • Peter Russell

    #2
    Re: Assigning a Variable OpenArgs

    Delete the word 'Set' (and make sure TempId is a string)

    regards

    Peter Russell


    nic previously wrote:
    [color=blue]
    > Hi am having difficulty understanding why the following is not
    > working.
    >
    > Dim TempID As Integer
    > Set TempID = Me.OpenArgs
    >
    > Knowing that OpenArgs is a string I then changed the declaration of
    > TempID to be String, but this does not work either.
    >
    > I have also tried
    >
    > Set TempID = Val(OpenArgs) 'where TempID is an integer.
    >
    > Can anyone suggest possible solutions. I need the value of OpenArgs
    > to be copied this TempID variale as I need it for a particular
    > programming purpose.
    >
    > Thanks
    >[/color]

    Comment

    • Lyle Fairfield

      #3
      Re: Assigning a Variable OpenArgs

      nicfantis@yahoo .co.uk (nic) wrote in news:aa26ac1d.0 402020346.6bf2a e33
      @posting.google .com:
      [color=blue]
      > Hi am having difficulty understanding why the following is not
      > working.
      >
      > Dim TempID As Integer
      > Set TempID = Me.OpenArgs
      >
      > Knowing that OpenArgs is a string I then changed the declaration of
      > TempID to be String, but this does not work either.
      >
      > I have also tried
      >
      > Set TempID = Val(OpenArgs) 'where TempID is an integer.
      >
      > Can anyone suggest possible solutions. I need the value of OpenArgs
      > to be copied this TempID variale as I need it for a particular
      > programming purpose.[/color]

      TempID = Me.OpenArgs

      --
      Lyle
      (for e-mail refer to http://ffdba.com/contacts.htm)

      Comment

      • Fletcher Arnold

        #4
        Re: Assigning a Variable OpenArgs

        "nic" <nicfantis@yaho o.co.uk> wrote in message
        news:aa26ac1d.0 402020346.6bf2a e33@posting.goo gle.com...[color=blue]
        > Hi am having difficulty understanding why the following is not
        > working.
        >
        > Dim TempID As Integer
        > Set TempID = Me.OpenArgs
        >
        > Knowing that OpenArgs is a string I then changed the declaration of
        > TempID to be String, but this does not work either.
        >
        > I have also tried
        >
        > Set TempID = Val(OpenArgs) 'where TempID is an integer.
        >
        > Can anyone suggest possible solutions. I need the value of OpenArgs
        > to be copied this TempID variale as I need it for a particular
        > programming purpose.
        >
        > Thanks[/color]



        You could use code similar to that shown below, making sure you have some
        kind of error-handling to take appropriate action if the OpenArgs cannot be
        converted into the required type.

        Dim lngMyID As Long

        If Not IsNull(Me.OpenA rgs) Then
        lngMyID = CLng(Me.OpenArg s)
        End If


        Fletcher


        Comment

        • Roger

          #5
          Re: Assigning a Variable OpenArgs

          Dim TempID As Integer
          TempID = cint(Me.OpenArg s)

          you don't need the word SET

          nicfantis@yahoo .co.uk (nic) wrote in message news:<aa26ac1d. 0402020346.6bf2 ae33@posting.go ogle.com>...[color=blue]
          > Hi am having difficulty understanding why the following is not
          > working.
          >
          > Dim TempID As Integer
          > Set TempID = Me.OpenArgs
          >
          > Knowing that OpenArgs is a string I then changed the declaration of
          > TempID to be String, but this does not work either.
          >
          > I have also tried
          >
          > Set TempID = Val(OpenArgs) 'where TempID is an integer.
          >
          > Can anyone suggest possible solutions. I need the value of OpenArgs
          > to be copied this TempID variale as I need it for a particular
          > programming purpose.
          >
          > Thanks[/color]

          Comment

          • Nicholas Fantis

            #6
            Re: Assigning a Variable OpenArgs

            Thanks Peter and Others

            Wasn't thinking straight. Because I needed TempID to be an integer I
            did it the following way.

            TempID = Var(OpenArgs)

            Having the following problem....Say I created a new record in a form and
            wanted all this data to be written to the Table when I clicked another
            button which loaded another form. Cannot get the form to write data to
            the table first, so in the second form because a referenced id does not
            yet exist it cannot write data to the second table.

            Thanks for any comments



            *** Sent via Developersdex http://www.developersdex.com ***
            Don't just participate in USENET...get rewarded for it!

            Comment

            Working...