S
Sprinks
After recently learning that, unlike the OpenQuery or RunSQL methods,
db.Execute enabled one to determine the result of the query, I changed a
previous RunSQL which was working to the following code. It generates an
error on the db.Execute statement "Too few parameters. Expected 2."
MsgBox statements reveal that strSQL is assigned correctly and that
dbFailOnError is equal to 128. Does anyone know what's going on?
Thank you.
Sprinks
Dim db As DAO.Database
Dim strSQL As String
Set db = DBEngine(0)(0)
strSQL = "INSERT INTO TSHistory (StaffID, PeriodEnding) " & _
"SELECT Timesheet.StaffID, [PeriodStartDate]+13 AS
PeriodEndDate " & _
"FROM Timesheet " & _
"WHERE
(((Timesheet.StaffID)=[Forms]![Timesheet]![txtStaffID]) " & _
"AND
((Timesheet.PeriodStartDate)=[Forms]![Timesheet]![PeriodStartDate]));"
db.Execute strSQL, dbFailOnError
Set db = Nothing
db.Execute enabled one to determine the result of the query, I changed a
previous RunSQL which was working to the following code. It generates an
error on the db.Execute statement "Too few parameters. Expected 2."
MsgBox statements reveal that strSQL is assigned correctly and that
dbFailOnError is equal to 128. Does anyone know what's going on?
Thank you.
Sprinks
Dim db As DAO.Database
Dim strSQL As String
Set db = DBEngine(0)(0)
strSQL = "INSERT INTO TSHistory (StaffID, PeriodEnding) " & _
"SELECT Timesheet.StaffID, [PeriodStartDate]+13 AS
PeriodEndDate " & _
"FROM Timesheet " & _
"WHERE
(((Timesheet.StaffID)=[Forms]![Timesheet]![txtStaffID]) " & _
"AND
((Timesheet.PeriodStartDate)=[Forms]![Timesheet]![PeriodStartDate]));"
db.Execute strSQL, dbFailOnError
Set db = Nothing