replace finished task with new one (1 Viewer)

steve111

Registered User.
Local time
Today, 03:35
Joined
Jan 30, 2014
Messages
429
hi,

I have a table that say has 1000 records in it called " all events"
I have a subform called tasks which comes from a query from the table " all events"

at present the query is set to "no" on the completed field
I also et the date field to <=now() + 7 so I only got 8 records in my subform and report. the report shows outstanding tasks. but I don't want to show say 900

7 days worth of records is all I need to see consistently

I have now realised this is not correct
what I would like it to do is every time I tick the completed field that record disappears ( of which it does) but I would like a new record to replace it . if I tick 5 records then 5 records replace then
it would be the next record in date order




any help appreciated
steve
 
Last edited:

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 10:35
Joined
May 7, 2009
Messages
19,249
you mean when you tick it as complete, same task (field values also i think) will be added but unmarked?
 

steve111

Registered User.
Local time
Today, 03:35
Joined
Jan 30, 2014
Messages
429
hi,

I have daily tasks ( unticked ). lets say 7 days worth in my from tasks. that I can see


when I tick that days task or 2 days tasks as completed from the list of tasks these 1 or 2 tasks will disappear and the next days or next 2 days task will appear in my form called tasks. these tasks are in date order therefore there is always 7 days worth of tasks seem in my task form

steve
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 10:35
Joined
May 7, 2009
Messages
19,249
so when you tick, records go away, the task below that you ticked, goes up (get promoted) on your list, and a new task emerges from the bottom of your list of task, is it right?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 10:35
Joined
May 7, 2009
Messages
19,249
you can't do it in query or table view, you need a form to accomplish this. you also need to add autonumber to your table (all events) and include it in your query.

on click event of your Tick control:
Code:
Private Sub [COLOR=Blue]yesNoControl[/COLOR]_Click()
    Dim rs As DAO.Recordset
    Dim lngID As Long
    Set rs = Me.RecordsetClone
    With rs
        ' set bookmark to our recordset
        .Bookmark = Me.Bookmark
        ' move to next record
        .MoveNext
        If .EOF Then .MovePrevious
        ' save the id
        lngID = ![COLOR=Blue]ID[/COLOR]
        .AddNew
        [COLOR=Purple]' do whaever you have here
        ' !datefield = Date() or Now()[/COLOR]
        .Update
        ' refresh the form to reflect the changes
        Me.Refresh
        ' requery our recordset to reflect change
        rs.Requery
        ' go to whre we were
        .FindFirst "[COLOR=Blue]id[/COLOR] = " & lngID
        If Not .NoMatch Then Me.Bookmark = .Bookmark
        .Close
    End With
    Set rs = Nothing        
End Sub
replace the blue-lettered to the correct control name, field name.
 

Users who are viewing this thread

Top Bottom