Run-Time Error '6'

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

    Run-Time Error '6'

    I've been getting a runtime error when i'm running one of my module in
    vba in access.

    strfield4 = CLng(strfield4)
    strfield4 = rstin("amt_issu ed")<--this is where the errors
    occurres.

    the amt_issued is coming from another table and the data type is set
    for DOUBLE.

    Please advise? thank you.

  • Billie Dee

    #2
    Re: Run-Time Error '6'

    is rstin a recordset? rstin.fields("a mt_issued") perhaps? It's hard
    to guess with too little information to go on. What's the error? What
    did you declare strfield4 to be?

    Billie Dee

    Comment

    • phong.lee@gmail.com

      #3
      Re: Run-Time Error '6'

      rstin is a recordset and i delcared strfield4 as a long.

      Comment

      • Ozzone

        #4
        Re: Run-Time Error '6'

        First of all the correct syntax to refer to a recordset field is
        rstin![amt_issued].

        Second, just Dim strfield4 as Long.

        Dim strfield4 as Long
        Set rstin = db.OpenRecordse t(strSQL)
        strfield4 = rstin![amt_issued]

        That should work fine. Access will automatically convert it from
        double to long.

        Comment

        • phong.lee@gmail.com

          #5
          Re: Run-Time Error '6'

          i have

          Set rstin = db.OpenRecordse t("tblsinkIN" , dbOpenTable)

          would that work too?

          Comment

          • Ozzone

            #6
            Re: Run-Time Error '6'

            It should.

            Comment

            Working...