I'm trying to create a recordset based on the base of a partid. I have a table and a query I'm using to establish the base. But the SQL that Access writes in the Query objects (where it works) doesn't seem to work in VBA. I get a "Join Expression Not Supported" error. Here is what I have tried..
strSQL = "SELECT * FROM qryDetailCRC "
Set db = CurrentDb()
Set recSubmittal = db.OpenRecordset(strSQL)
strProdNum = Me.PartsID
strPartsBase = Left(recSubmittal!PartNo, 5)
strSQL = "SELECT * FROM qryDetailCRC " & _
" INNER JOIN tblSubmittal ON qryDetailCRC.ID = " & strProdNum & _
" WHERE qryDetailCRC.Base ='" & strPartsBase & "';"
Set recSubmittal = db.OpenRecordset(strSQL)
What I want is all the parts that have the same base as the part in the current record (the button on the form starts the ball rolling). I don't have the Base in the table the form populates, but it is in the query and the PartsID matches the queries id field.
Any clues how I can make this work?
strSQL = "SELECT * FROM qryDetailCRC "
Set db = CurrentDb()
Set recSubmittal = db.OpenRecordset(strSQL)
strProdNum = Me.PartsID
strPartsBase = Left(recSubmittal!PartNo, 5)
strSQL = "SELECT * FROM qryDetailCRC " & _
" INNER JOIN tblSubmittal ON qryDetailCRC.ID = " & strProdNum & _
" WHERE qryDetailCRC.Base ='" & strPartsBase & "';"
Set recSubmittal = db.OpenRecordset(strSQL)
What I want is all the parts that have the same base as the part in the current record (the button on the form starts the ball rolling). I don't have the Base in the table the form populates, but it is in the query and the PartsID matches the queries id field.
Any clues how I can make this work?