1 Reply Latest reply on Jan 16, 2013 7:45 PM by beyerch2

    compare integer value of text/string in OUTER JOIN ON clause  in sql in vba

      I would like to execute the SQL statement below in vba code written for MS Access, and I want the integer values of the ID fields to be compared in the JOIN ON criteria. However, I get an error when using CInt(). I've also tried Val(), CAST(), and Convert().
      Set RecordSet = "SELECT A.id, B.id FROM A LEFT OUTER JOIN B ON CInt(A.id)=CInt(B.id)"

      the entire id contains only numbers. For example A.id=0123, and B.id=00123 . I want to compare the value integer of the two so that A.id=B.id is true.