Hi,
I have the following table called tblShift: -
*Shift_ID
Employee_ID
Shift_Day
Shift_Start
Shift_End
Shift_Wk_End
What I'm trying to do is have a form with two text boxes and a command button. In text box 1 I want to enter a 'Shift_Wk_End' date and in text box 2 I want to enter a different date. The when I click the command button it looks at the table specified above (tblShift) and I want it to copy each record which has a 'Shift_Wk_End' which matches that entered in text box 1 (OldDate), and I want it to create duplicated of those records but changing the 'Shift_Wk_End to the date entered in text box 2 (NewDate).
Basically the table holds info on peoples shifts and the 'Shift_Wk_End' field identifies the week ending date which the shift is for. What I'm trying to do is to create a way of easily setting up the shifts for the next week in question (with a different week ending date).
I've figured I need something along the lines of the statement below, although it's bringing back a syntax error: -
Any suggestions would be very much appreciated.
Thanks
I have the following table called tblShift: -
*Shift_ID
Employee_ID
Shift_Day
Shift_Start
Shift_End
Shift_Wk_End
What I'm trying to do is have a form with two text boxes and a command button. In text box 1 I want to enter a 'Shift_Wk_End' date and in text box 2 I want to enter a different date. The when I click the command button it looks at the table specified above (tblShift) and I want it to copy each record which has a 'Shift_Wk_End' which matches that entered in text box 1 (OldDate), and I want it to create duplicated of those records but changing the 'Shift_Wk_End to the date entered in text box 2 (NewDate).
Basically the table holds info on peoples shifts and the 'Shift_Wk_End' field identifies the week ending date which the shift is for. What I'm trying to do is to create a way of easily setting up the shifts for the next week in question (with a different week ending date).
I've figured I need something along the lines of the statement below, although it's bringing back a syntax error: -
Code:
DoCmd.RunSQL (insert into tblShift select Employee_ID, Shift_Day, Shift_Start, Shift_End, Forms!frmShift_Update_WK_End!NewDate as Shift_Wk_End from tblShift where Shift_Wk_End = Forms!frmShift_Update_WK_End!OldDate;)
Any suggestions would be very much appreciated.
Thanks