G
Guest
I am trying to test the validity of the data on a form before closing the
form. I get the error 'Run-Time Error 3061. Too few parameters. Expected
6.' The data in tblAuditResultQuestions comes from a subform. I got the
same error when I substituted ME! for [Form]![frmAudit ResultsChange]. Here
is the code:
Dim strSQL As String
Dim rst As DAO.Recordset
Dim cntNo As Integer
strSQL = "SELECT Count(tblAuditResultQuestions.QuestionNumber) AS CountBad "
& _
'"FROM tblAuditResultQuestions " & _
'"WHERE (((tblAuditResultQuestions.FacilityCode)=[Form]![frmAudit
ResultsChange]![txtFacilityCode]) AND " & _
'"((tblAuditResultQuestions.FacilityPlant)=[Form]![frmAudit
ResultsChange]![txtFacilityPlant]) AND " & _
'"((tblAuditResultQuestions.ProcessName)=[Form]![frmAudit
ResultsChange]![txtProcessName]) AND " & _
'"((tblAuditResultQuestions.AuditDate)=[Form]![frmAudit
ResultsChange]![txtAuditDate]) AND " & _
'"((tblAuditResultQuestions.Level)=[Form]![frmAudit
ResultsChange]![txtLevel]) AND " & _
'"((tblAuditResultQuestions.Shift)=[Form]![frmAudit
ResultsChange]![txtShift]) AND " & _
'"((tblAuditResultQuestions.Pass)='No') AND ((IIf([CorrectiveAction] Is
Null,'Y','N'))='Y'));"
Set rst = CurrentDb.OpenRecordset(strSQL)
cntNo = rst.Fields("CountBad").Value
rst.Close
Any help would be appreciated
Thanks
Marni
form. I get the error 'Run-Time Error 3061. Too few parameters. Expected
6.' The data in tblAuditResultQuestions comes from a subform. I got the
same error when I substituted ME! for [Form]![frmAudit ResultsChange]. Here
is the code:
Dim strSQL As String
Dim rst As DAO.Recordset
Dim cntNo As Integer
strSQL = "SELECT Count(tblAuditResultQuestions.QuestionNumber) AS CountBad "
& _
'"FROM tblAuditResultQuestions " & _
'"WHERE (((tblAuditResultQuestions.FacilityCode)=[Form]![frmAudit
ResultsChange]![txtFacilityCode]) AND " & _
'"((tblAuditResultQuestions.FacilityPlant)=[Form]![frmAudit
ResultsChange]![txtFacilityPlant]) AND " & _
'"((tblAuditResultQuestions.ProcessName)=[Form]![frmAudit
ResultsChange]![txtProcessName]) AND " & _
'"((tblAuditResultQuestions.AuditDate)=[Form]![frmAudit
ResultsChange]![txtAuditDate]) AND " & _
'"((tblAuditResultQuestions.Level)=[Form]![frmAudit
ResultsChange]![txtLevel]) AND " & _
'"((tblAuditResultQuestions.Shift)=[Form]![frmAudit
ResultsChange]![txtShift]) AND " & _
'"((tblAuditResultQuestions.Pass)='No') AND ((IIf([CorrectiveAction] Is
Null,'Y','N'))='Y'));"
Set rst = CurrentDb.OpenRecordset(strSQL)
cntNo = rst.Fields("CountBad").Value
rst.Close
Any help would be appreciated
Thanks
Marni