Hi
I am trying to execute an SQL statement and I am getting an error that no value is given for one or more parameters but I cannot fathom it. When I run it as a query it works perfectly and I wondered if it was something to do with referencing the textboxes?
strSQL = "UPDATE [tblStaffDays] SET [tblStaffDays].[bytStatCode] = 2 " & _
"WHERE ((([tblStaffDays].[bytStatCode])<>7 And ([tblStaffDays].[bytStatCode])<>20 And ([tblStaffDays].[bytStatCode])<>10) AND (([tblStaffDays].[lngEmpNo])=[Forms]![frmHolidayEntry]![cboEmp]) AND (([tblStaffDays].[dtmDate]) Between [forms]![frmHolidayEntry]![txtHolStart] And [forms]![frmHolidayEntry]![txtHolEnd]));"
Data is entered on the form and then you hit the button which sets off this code. I have double checked the form name and the textbox names and they are all OK, so why is it giving me problems?
I could run it as a DoCmd.OpenQuery but would prefer to move it to a cnn.execute.
Any help very much appreciated.
Best wishes
Malcy
I am trying to execute an SQL statement and I am getting an error that no value is given for one or more parameters but I cannot fathom it. When I run it as a query it works perfectly and I wondered if it was something to do with referencing the textboxes?
strSQL = "UPDATE [tblStaffDays] SET [tblStaffDays].[bytStatCode] = 2 " & _
"WHERE ((([tblStaffDays].[bytStatCode])<>7 And ([tblStaffDays].[bytStatCode])<>20 And ([tblStaffDays].[bytStatCode])<>10) AND (([tblStaffDays].[lngEmpNo])=[Forms]![frmHolidayEntry]![cboEmp]) AND (([tblStaffDays].[dtmDate]) Between [forms]![frmHolidayEntry]![txtHolStart] And [forms]![frmHolidayEntry]![txtHolEnd]));"
Data is entered on the form and then you hit the button which sets off this code. I have double checked the form name and the textbox names and they are all OK, so why is it giving me problems?
I could run it as a DoCmd.OpenQuery but would prefer to move it to a cnn.execute.
Any help very much appreciated.
Best wishes
Malcy