From: Daryl S on
John -

You can use this syntax in the code - back up your database before playing
with this one...

DoCmd.RunCommand acCmdDeleteRecord

--
Daryl S


"jegrau" wrote:

> I currently have code in a form called workorders to execute after update to
> copy data over to a new form called Closed_Workorders. using two different
> tables (tasks and closed tasks) How do
> I write the code to delete the record once it is copied.
>
> "Thanks for your Support"
> Here is the code:
>
> Private Sub Status_AfterUpdate()
>
> If Status = "Completed" Then
>
> Dim StDocName As String
> Dim StDocnbr As String
>
> StDocName = "Completed_WorkOrders"
> StDocnbr = [Log_Number]
> DoCmd.OpenForm StDocName
> DoCmd.GoToRecord , , acNewRec
> Forms![Completed_WorkOrders].Log_Number = Forms![workorders].Log_Number
> Forms![Completed_WorkOrders].Priority = Forms![workorders].Priority
> Forms![Completed_WorkOrders].Status = Forms![workorders].Status
> Forms![Completed_WorkOrders].[%_Complete] = Forms![workorders].[%_Complete]
> Forms![Completed_WorkOrders].[Requested_By] = Forms![workorders].Requested_By
> Forms![Completed_WorkOrders].Assigned_To = Forms![workorders].Assigned_To
> Forms![Completed_WorkOrders].[Description] = Forms![workorders].Description
> Forms![Completed_WorkOrders].Start_Date = Forms![workorders].Start_Date
> Forms![Completed_WorkOrders].Due_Date = Forms![workorders].Due_Date
> Forms![Completed_WorkOrders].Completion_date =
> Forms![workorders].Completion_date
> Forms![Completed_WorkOrders].[Cost_Center_Charge Code] =
> Forms![workorders].[Cost_Center_Charge Code]
> Forms![Completed_WorkOrders].Forced_Account_or_Contract =
> Forms![workorders].Forced_Account_or_Contract
> Forms![Completed_WorkOrders].Turned_Over_to_Procurment_on =
> Forms![workorders].Turned_Over_to_Procurment_on
> Forms![Completed_WorkOrders].Comments = Forms![workorders].Comments
> Forms![Completed_WorkOrders].Cost_Center_OrgCode =
> Forms![workorders].Cost_Center_OrgCode
> Forms![Completed_WorkOrders].Functional_Area_Prg_Elmt =
> Forms![workorders].Functional_Area_Prg_Elmt
> Forms![Completed_WorkOrders].[Project_Number] =
> Forms![workorders].Project_Number
>
> Forms![Completed_WorkOrders].[Special_Considerations] =
> Forms![workorders].Special_Considerations
>
> End If
>
> End Sub
>
>
> --
> John E. Grau
> IT Specialist
> Bureau of Land Managment
> Miles City Field Office
> Miles City MT 59301
> jgrau(a)blm.gov