email issue...works only ONE TIME

M

Mike Robinson

If anyone can help me with this issue I would greatly appreciate it.
I have a work order system and I would like to email specific information.
Instead of attaching a file, I have chosen to add the information into the
email's message text.
The problem that I am having is that the code I am using will only
work ONE time. The 2nd time you try to execute the code I get...
"...Can't find the field 'Forms' refered to in your expression".

Here is the code I am using:
'On Error GoTo ERR01

Dim strSubject, strMessageText As String

strSubject = "Work Order: " & Me.txtWorkOrderNumber

strMessageText = Chr(13) & Chr(10) & Chr(13) & Chr(10) & Chr(13) & Chr(10)
'Add some space from top
strMessageText = strMessageText &
"*****************************************************************"
strMessageText = strMessageText & Chr(13) & Chr(10)
strMessageText = strMessageText & "Work Order: " & Me.txtWorkOrderNumber
strMessageText = strMessageText & Chr(13) & Chr(10) & _
"Entered: " & Me.txtDateEntered & Chr(13) & Chr(10)
strMessageText = strMessageText & Chr(13) & Chr(10) & _
"Target: " & Me.txtDateTarget & Chr(13) & Chr(10)
strMessageText = strMessageText & Chr(13) & Chr(10) & _
"Equipment: " & Me.txtEquipmentName & Chr(13) & Chr(10)
strMessageText = strMessageText & Chr(13) & Chr(10) & _
"Task: " & Me.txtTask & Chr(13) & Chr(10)
strMessageText = strMessageText & Chr(13) & Chr(10) & _
"Details: " & Me.txtWorkOrderDetails & Chr(13) & Chr(10)
strMessageText = strMessageText &
"*****************************************************************" 'Visual
Seperator

DoCmd.SendObject acSendNoObject, , acFormatTXT, , , , strSubject,
strMessageText

'ERR01:
'Debug.Print Err.Number
'Debug.Print Err.Description

'Exit Sub

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top