siddhusingh1968
New member
- Local time
- Today, 07:56
- Joined
- Apr 9, 2011
- Messages
- 7
Move date value from previous record - works - no record error
I am a new member (Joined today!!). I have a database that has a basic MS Project structure i.e. for each task Plan_Start, Plan_End, Duration. When assigned to members the tasks are sequential, Plan_End is calculated based on adding Duration to Plan_Start. So now if a member adjusts the duration of one of his tasks in order to adjust dates downstream this is what I wrote: "Using Access 2007 on Home PC and Access 2003 on work PC"
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone
Dim PREVDATE As String 'This will hold the value of the Plan_End of the task in a variable to carry to Plan_Start of next record
If rst.RecordCount <> 0 Then
End If
rst.MoveFirst 'moves cursor to first record
Do While Not rst.EOF
PREVDATE = rst.Fields("dtend") ' Copies Plan_End from first record
'Temporarily store this date value
rst.MoveNext ' moves cursor to next
rst.Edit
rst.Fields("Start") = PREVDATE 'Puts value held in PREVDATE variable in Plan_Start of next record
rst.Update
Loop
End Sub
The code works and updates the dates fine, but I get a No Current Record Error=3021. I cannot figure out trapping this error. Please help..
I am a new member (Joined today!!). I have a database that has a basic MS Project structure i.e. for each task Plan_Start, Plan_End, Duration. When assigned to members the tasks are sequential, Plan_End is calculated based on adding Duration to Plan_Start. So now if a member adjusts the duration of one of his tasks in order to adjust dates downstream this is what I wrote: "Using Access 2007 on Home PC and Access 2003 on work PC"
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone
Dim PREVDATE As String 'This will hold the value of the Plan_End of the task in a variable to carry to Plan_Start of next record
If rst.RecordCount <> 0 Then
End If
rst.MoveFirst 'moves cursor to first record
Do While Not rst.EOF
PREVDATE = rst.Fields("dtend") ' Copies Plan_End from first record
'Temporarily store this date value
rst.MoveNext ' moves cursor to next
rst.Edit
rst.Fields("Start") = PREVDATE 'Puts value held in PREVDATE variable in Plan_Start of next record
rst.Update
Loop
End Sub
The code works and updates the dates fine, but I get a No Current Record Error=3021. I cannot figure out trapping this error. Please help..
Last edited: