UPDATED:
I'm attempting to setup a form "Tasks", where when you click a button it will take all records with a [Status] of 10 and copy them, The previous records would then get marked as [Status] 100.
So what I have is the following "before" datasheet view:
Once you run the code it will look as follows:
So the code will duplicate all records that have a [Status] of 10 ("In Progress") mark the old records as [Status] 100 ("Completed") and timestamp the [Date Completed] Field.
Hopefully this helps clarify a bit more of what I'm trying to do.
Code is as follows:
Public Sub Duplicate_Click()
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("SELECT * FROM tblTasks")
rs.MoveFirst
If Not (rs.EOF And rs.BOF) And Me.Status = 10 Then
Do Until rs.EOF = True
'Copy/Paste In Process Tasks
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdCopy
DoCmd.RunCommand acCmdPasteAppend
[Status].Value = 0
rs.MoveNext
Loop
Else
MsgBox ("Nothing Done")
'do nothing
End If
MsgBox ("Complete")
rs.Close 'Close the recordset
Set rs = Nothing 'Clean up
End Sub