This is what I have and want to do. I have a main form for Work Orders. It contains the Work Order#, dates and the person who created the work order along with their email address. (Tbl_tta, uses query qfrm_main)
On my main form I have a subform for the Work order items, could be more than one. This form contains items like type of work to be performed and other details to that line item. (Tbl_MAC)
Then on the subform there is another subform for the Workorder item status. The status can change multiple times and I would like to keep the history of changes.
What I want is when a tech updates a line item to send an email to the person that created work order. I have search for a few days and looked at all different type of code before I tried my code.
I created my button with the code below and it crashes, when I hit Debug in the pop-up this line is highlighted. "Dim www As dao.Recordset"
Edit: The error I get is Run-time error 424, Object required.
Code:
Private Sub cmd_SendUpdate_Click()Dim msg_body As String
Dim msg_subject As String
Dim msg_to As String
Dim www As dao.Recordset
Set www = frm_tta.RecordsetClone
msg_subject = "Workorder# " & www!WO & " has been updated."
msg_body = "A workorder you created was recently updated. Please access the workorder in the database."
msg_to = www!PreEmail
DoCmd.SendObject acSendNoObject, , , msg_to, , , msg_subject, msg_body
End Sub
Here is a screen shot of my forms.
Any help with this would be greatly appreciated.
Thanks!