Hi,
I have an access database whereby i import common tasks into a tasks table where they are linked to the current project.
Each task has a start date, end date and due date and a process order number.
What i want to do is create a macro/query/vba?! so that as the tasks are imported the lowest process number gets a start date of today i.e. now () and when that task is closed the next process order number in line gets a start date of the previous process number's end date.
As the common tasks are optional, it could be that the process number increments jump e.g. 1,2,4,5,6,8,10 etc.
Any ideas
Many thanks
Brendan
Are those fields filled in when you import? That would be somewhat odd, but it's hard to tell from your question.
Instead, it's common that you would import Tasks associated with a Project (and relate them to that Project). Then, as you complete a Task (and enter an End Date value) you could then stamp the "next" Task with the Start Date, based on that End Date.
This is most easily done in the Form where you modify the Task. You could run code like this, perhaps in the AfterUpdate event of the Form:
'/ make sure an End Date is available
If Nz(Me.YourEndDate,0) <>0 Then
'/ get the next ProcessNumber
Dim ProcessNum As Double
ProcessNum = DMin("ProcessNumber", "TaskTables", "EndDate IS NOT NULL")
Currentdb.Execute "UPDATE TasksTable SET StartDate=#" & Me.YourEndDate & "# WHERE TaskID=" & Me.TaskID & " AND ProcessNumber=" & ProcessNum
End If
Obviously this is air-code, and you'd have to change the Table, Field and Control names to match your own.