I built a continuous form on this Deadlines table.
I need a way for the user to indicate when a record has been completed, and the next due date to be determined and updated in the source.
I do have a 'yes/no' field on the underlying table. So, the form shows this checkbox. I thought, the user could mark each deadline that is complete and then click a single command button 'Update', and it would loop through the records and unmark the box, increment the date, and then save.
Problems:
1. If all records are marked, it doesn't edit every record (I tried a loop that only unmarked the box, and it stops on the last record every time).
2. When I added the DataAdd method to the events, mark only a single record to update, it will remove the checkmark from the correct record, will retrieve the DataAdd information from the correct record, but then increments the date for the First record present. ?!?!?!
I have included my current VBA below:
Expand|Select|Wrap|Line Numbers
- Dim rst As DAO.Recordset
- Set rst = Me.RecordsetClone
- rst.MoveFirst
- Do Until rst.EOF
- rst.Bookmark = Me.Bookmark
- If [Forms]![frm_Deadlines2]![Task_Done] = True Then
- [Forms]![frm_Deadlines2]![Task_Done] = False
- Dim strInterval As String
- Dim strNum As Double
- Dim strDate As Date
- Dim strNew As Date
- strInterval = Me.txt_interval.Value
- strNum = Me.txt_number.Value
- strDate = Me.Task_Due.Value
- strNew = DateAdd(strInterval, strNum, strDate)
- rst.Edit
- rst.Fields("Task_Due").Value = strNew
- rst.Update
- End If
- Me.Bookmark = rst.Bookmark
- rst.MoveNext
- Loop
- rst.Close