Hi all,
I have VBA code tied to an Add Record Command button. However, when the SQL string is executed, the error message "Run-time error 3061. Too few parameters. Expected 3." is displayed. I have reviewed the SQL string for mismatch parenthesis, but cannot find any. Any help in solving this would be appreciated.
I have VBA code tied to an Add Record Command button. However, when the SQL string is executed, the error message "Run-time error 3061. Too few parameters. Expected 3." is displayed. I have reviewed the SQL string for mismatch parenthesis, but cannot find any. Any help in solving this would be appreciated.
Code:
Private Sub AddRecord_Exit(Cancel As Integer)
Dim db As DAO.Database
Dim fldActive As String
Dim fldSysadd As String
Dim fldRetire As String
Dim strSQL As String
fldActive = "Active"
fldSysadd = "System Added"
fldRetire = "Retired"
Set db = CurrentDb
strSQL = "INSERT INTO tblAuditJobsMaster ( CoStarID ) " & _
"SELECT tblCostarJobMaster.JobID " & _
"FROM tblCostarJobMaster " & _
"LEFT JOIN tblAuditJobsMaster " & _
"ON tblCostarJobMaster.[JobID] = tblAuditJobsMaster.[CoStarID] " & _
"WHERE (((tblAuditJobsMaster.CoStarID) Is Null) " & _
"AND ((tblCostarJobMaster.JobStatus)=fldActive Or (tblCostarJobMaster.JobStatus)=fldSysAdd Or (tblCostarJobMaster.JobStatus)=fldRetire))" & ";"
DoCmd.SetWarnings False
db.Execute strSQL
DoCmd.SetWarnings True
db.Close
End Sub