marcellvries
Programmer
Hi there,
Currently I'm designing a planning system in MS Access for a security company. It is going well but I got stuck at one issue.
Background
I have a table tblPlanning with the following fields:
PlanningID, LocationID, EmployeeID, Startdate, Enddate, Starttime, Endtime. I have a continuous form that shows tblPlanning for one specific LocationID (filled in already as chosen in a previous dialog form) and enables you to add new records.
Problem
The thing is that for a specific club, on average, 12 records per week are needed. The start- and endtimes, and the security officers (employeeID) are kind of fixed most of the time. Currently, it takes a lot of time to add the planning for one club for one single week. It takes probably longer than writing it down.
What I would like to do is to add a button on the form that copies last week's planning.
I don't know how to achieve this but here are my thoughts.
My thoughts
(1)Maybe a recordset (rstcopy) should be created:
Select * from tblPlanning where LocationID = txtLocationID and Week = Lastweek.
(2)Then all records in rstcopy should be modified like "startdate+7".
(3)Subsequently all the (adjusted) records should be added to tblPlanning with an append statement (don't know how to handle the autonumber primary key PlanningID by the way).
(4)Finally the form will be refreshed (Me.Requery).
Question
Does anyone know how could I achieve this?
Thank you in advance. I hope I have been clear in what I have and what I would like to do. If not, I'm happy to provide additional information.
With kind regards,
Marcell
Currently I'm designing a planning system in MS Access for a security company. It is going well but I got stuck at one issue.
Background
I have a table tblPlanning with the following fields:
PlanningID, LocationID, EmployeeID, Startdate, Enddate, Starttime, Endtime. I have a continuous form that shows tblPlanning for one specific LocationID (filled in already as chosen in a previous dialog form) and enables you to add new records.
Problem
The thing is that for a specific club, on average, 12 records per week are needed. The start- and endtimes, and the security officers (employeeID) are kind of fixed most of the time. Currently, it takes a lot of time to add the planning for one club for one single week. It takes probably longer than writing it down.
What I would like to do is to add a button on the form that copies last week's planning.
Code:
Private Sub cmdCopy_Click()
Dim LastWeek As Integer
LastWeek = DatePart("ww", Now(), vbMonday) - 1
End Sub
I don't know how to achieve this but here are my thoughts.
My thoughts
(1)Maybe a recordset (rstcopy) should be created:
Select * from tblPlanning where LocationID = txtLocationID and Week = Lastweek.
(2)Then all records in rstcopy should be modified like "startdate+7".
(3)Subsequently all the (adjusted) records should be added to tblPlanning with an append statement (don't know how to handle the autonumber primary key PlanningID by the way).
(4)Finally the form will be refreshed (Me.Requery).
Question
Does anyone know how could I achieve this?
Thank you in advance. I hope I have been clear in what I have and what I would like to do. If not, I'm happy to provide additional information.
With kind regards,
Marcell