I have the following code in a standard Access 2003 query that works fine:
And here it is again in VBA format:
The problem is, I get the following error when I attempt to run the code:
Code:
SELECT tbl_MasterSubCaseIDQuery.CaseNumber, tbl_MasterSubCaseIDQuery.CaseID, tbl_MasterSubCaseIDQuery.SubcaseID, '' AS CustodianID, '' AS EvidenceID, '' AS LogID
FROM tbl_MasterSubCaseIDQuery
WHERE tbl_MasterSubCaseIDQuery.CaseID=[number];
Code:
SQL = "SELECT tbl_MasterSubCaseIDQuery.CaseNumber, tbl_MasterSubCaseIDQuery.CaseID, tbl_MasterSubCaseIDQuery.SubcaseID, '' AS CustodianID, '' AS EvidenceID, '' AS LogID" & _
"FROM tbl_MasterSubCaseIDQuery" & _
"WHERE tbl_MasterSubCaseIDQuery.CaseID = " & Me.CaseID.Value
Any idea why?The SELECT statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect.