RunTime Error 5

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • phong.lee@gmail.com

    RunTime Error 5

    Is there a reason why i keep getting this run time error, i never
    gotten it before. Can someone help me out with this? here is my code:

    With rstout
    'first check if not on EOF
    If Not (rstin.EOF) Then
    rstin.MoveFirst
    'loop through all the records rstIN (table tblPhongParseIN )
    Do While Not rstin.EOF
    'set strField1 to tblPhongParseIN Field1
    strField1 = rstin("ID")
    cutstring = Left([strField1], InStr([strField1], " ") -
    1)<------This is where i get the error.
    strfield4 = rstin("amt_issu ed")

    THank you.

  • jimfortune@compumarc.com

    #2
    Re: RunTime Error 5

    phong.lee@gmail .com wrote:[color=blue]
    > Is there a reason why i keep getting this run time error, i never
    > gotten it before. Can someone help me out with this? here is my code:
    >
    > With rstout
    > 'first check if not on EOF
    > If Not (rstin.EOF) Then
    > rstin.MoveFirst
    > 'loop through all the records rstIN (table tblPhongParseIN )
    > Do While Not rstin.EOF
    > 'set strField1 to tblPhongParseIN Field1
    > strField1 = rstin("ID")
    > cutstring = Left([strField1], InStr([strField1], " ") -
    > 1)<------This is where i get the error.
    > strfield4 = rstin("amt_issu ed")
    >
    > THank you.[/color]

    Phong,

    When I try MsgBox (Left("My Text", -1)), I get error message 5. That
    seems to suggest that " " is not being found in [strField1] causing a
    -1 to show up in the Length argument. Also, assuming strField1 is
    declared to be a string, there shouldn't be any square brackets around
    it. Maybe Access is looking for Me.strField1 because of the square
    brackets. Anyway, MsgBox("*" & strField1 & "*") to see if it contains
    a blank or not. I also don't see why you need to require a " " in an
    'ID' field. Perhaps use an If..Then..Else on whether or not
    InStr(strField1 , " ") = 0.

    James A. Fortune

    Comment

    • phong.lee@gmail.com

      #3
      Re: RunTime Error 5

      Thanks for the reply. i'm just trying to parse this string into
      fields.

      i have a field that looks like this

      Field 1
      12345678 MASS
      Field 2
      ;2;3;3;5;08/01/2014;3;100.0000 ;2;1395000.00;5 ;08/01/2015;3;100.0000 ;2;1475000.00;5 ;08/01/2016;3;100.0000 ;2;1555000.00;

      i'm just trying to parse field one without the MASS section, and the
      second field i was trying to parse out everything except for the DATE
      and the PRICE field. Please advise.

      Comment

      • phong.lee@gmail.com

        #4
        Re: RunTime Error 5

        sometime field one has more then 9 characters long. So i guess i'm
        just looking for a better to parse field one without it bombing.
        thanks.

        Comment

        • jimfortune@compumarc.com

          #5
          Re: RunTime Error 5


          phong.lee@gmail .com wrote:[color=blue]
          > Thanks for the reply. i'm just trying to parse this string into
          > fields.
          >
          > i have a field that looks like this
          >
          > Field 1
          > 12345678 MASS
          > Field 2
          > ;2;3;3;5;08/01/2014;3;100.0000 ;2;1395000.00;5 ;08/01/2015;3;100.0000 ;2;1475000.00;5 ;08/01/2016;3;100.0000 ;2;1555000.00;
          >
          > i'm just trying to parse field one without the MASS section, and the
          > second field i was trying to parse out everything except for the DATE
          > and the PRICE field. Please advise.[/color]

          If you are using Access 2000 or higher, you can use the split function
          to parse the strings. Does Field 1 always contain a space? I don't
          know what the split function will do to ";2;3..." when using ";" as a
          delimiter. You'll have to try it.

          James A. Fortune

          Comment

          • phong.lee@gmail.com

            #6
            Re: RunTime Error 5

            Field 1 always has a space. i'm able to parse field 2. it's just i
            don't understand why field 1 doesn't work.

            Comment

            • jimfortune@compumarc.com

              #7
              Re: RunTime Error 5

              phong.lee@gmail .com wrote:[color=blue]
              > Field 1 always has a space. i'm able to parse field 2. it's just i
              > don't understand why field 1 doesn't work.[/color]

              After checking out:



              Grab the space character and examine its asc() value to be sure it's a
              normal space character.

              James A. Fortune

              Comment

              • Douglas J. Steele

                #8
                Re: RunTime Error 5

                What's cutstring declared as? Is it possibly a numeric variable by mistake?

                --
                Doug Steele, Microsoft Access MVP

                (no e-mails, please!)



                <phong.lee@gmai l.com> wrote in message
                news:1118088140 .457726.325400@ f14g2000cwb.goo glegroups.com.. .[color=blue]
                > Is there a reason why i keep getting this run time error, i never
                > gotten it before. Can someone help me out with this? here is my code:
                >
                > With rstout
                > 'first check if not on EOF
                > If Not (rstin.EOF) Then
                > rstin.MoveFirst
                > 'loop through all the records rstIN (table tblPhongParseIN )
                > Do While Not rstin.EOF
                > 'set strField1 to tblPhongParseIN Field1
                > strField1 = rstin("ID")
                > cutstring = Left([strField1], InStr([strField1], " ") -
                > 1)<------This is where i get the error.
                > strfield4 = rstin("amt_issu ed")
                >
                > THank you.
                >[/color]


                Comment

                • phong.lee@gmail.com

                  #9
                  Re: RunTime Error 5

                  I got it to work. i had to change some query that was bringing my data
                  into the table. So i'm getting a runtime error 6 stating an overflow?
                  i do not know how that error is coming up and why. can someone adivse
                  on that? thank you.

                  Comment

                  • phong.lee@gmail.com

                    #10
                    Re: RunTime Error 5

                    I got it to work. i had to change some query that was bringing my data
                    into the table. So i'm getting a runtime error 6 stating an overflow?
                    i do not know how that error is coming up and why. can someone adivse
                    on that? thank you.

                    Comment

                    • jimfortune@compumarc.com

                      #11
                      Re: RunTime Error 5


                      phong.lee@gmail .com wrote:[color=blue]
                      > I got it to work. i had to change some query that was bringing my data
                      > into the table. So i'm getting a runtime error 6 stating an overflow?
                      > i do not know how that error is coming up and why. can someone adivse
                      > on that? thank you.[/color]

                      If the value is an integer, use Long as the field's data type. If not,
                      try the Double data type.

                      James A. Fortune

                      Comment

                      Working...