Hi,
I am trying to get this query to run from VBA but keep getting "Expected end of statement error".
Within in this I am trying to add the string months to a value using "as" & I think I have got my & " messed up.
strSQL = "SELECT tblRisk.RiskRef, tblRisk.RiskDesc, tblrisk.ReviewFreq" & " Months" & " AS Review, tblReview.ReviewDT AS LastReviewed," _
& " tblAssessor.AssessorName, tblRisk.Process, tblRisk.Task, tblPersAtRisk.PersDesc, tblRisk.Comments," _
& " tblRisk.Method, tblRisk.ControlMeasure, tblRisk.Impact, tblRisk.Likelihood, tblSite.SiteDesc, tblDept.DeptDesc" _
& " FROM tblSite" _
& " INNER JOIN (tblDept INNER JOIN (((tblRisk INNER JOIN tblReview ON tblRisk.RiskRef = tblReview.RiskRef)" _
& " INNER JOIN tblAssessor ON tblReview.AssessorRef = tblAssessor.AssessorRef)" _
& " INNER JOIN tblPersAtRisk ON tblRisk.PersRef = tblPersAtRisk.PersRef) ON tblDept.DeptRef = tblRisk.DeptRef)" _
& " ON tblSite.SiteRef = tblRisk.SiteRef" _
& " WHERE "tblRisk.SiteRef =" & me.txtSiteRef & " AND tblRisk.RiskRef =" & Me.txtRiskRef
Thanks in advance.
I am trying to get this query to run from VBA but keep getting "Expected end of statement error".
Within in this I am trying to add the string months to a value using "as" & I think I have got my & " messed up.
strSQL = "SELECT tblRisk.RiskRef, tblRisk.RiskDesc, tblrisk.ReviewFreq" & " Months" & " AS Review, tblReview.ReviewDT AS LastReviewed," _
& " tblAssessor.AssessorName, tblRisk.Process, tblRisk.Task, tblPersAtRisk.PersDesc, tblRisk.Comments," _
& " tblRisk.Method, tblRisk.ControlMeasure, tblRisk.Impact, tblRisk.Likelihood, tblSite.SiteDesc, tblDept.DeptDesc" _
& " FROM tblSite" _
& " INNER JOIN (tblDept INNER JOIN (((tblRisk INNER JOIN tblReview ON tblRisk.RiskRef = tblReview.RiskRef)" _
& " INNER JOIN tblAssessor ON tblReview.AssessorRef = tblAssessor.AssessorRef)" _
& " INNER JOIN tblPersAtRisk ON tblRisk.PersRef = tblPersAtRisk.PersRef) ON tblDept.DeptRef = tblRisk.DeptRef)" _
& " ON tblSite.SiteRef = tblRisk.SiteRef" _
& " WHERE "tblRisk.SiteRef =" & me.txtSiteRef & " AND tblRisk.RiskRef =" & Me.txtRiskRef
Thanks in advance.