Try to use SendObj to send e-mails from form

  • Thread starter Thread starter ChuckW
  • Start date Start date
C

ChuckW

Hi,

I have a form called Tickets. There is a combo box
called ComboAssignedTo which allows me to select one of
three people. The selections are actually their e-mail
address. There is also another combo box called
comboRequestor which enables me to select an Employee.
Finally there is a text box called Problem which is a
brief description of the computer problem that the person
in the requestor combo box is having. I want to assign
these tickets to one of three IT people in the
comboAssignedTo box.

I created a macro called Assigned to and selected the
SendObject action. in the Object Type I selected Form.
In the Object name I selected Tickets (the name of my
form). In the Output Format I choose Text File (I'm not
sure what to chose here). In the To box I wrote [Forms]!
[Tickets}!ComboAssignedTo}. In the Subject box I wrote
[Forms]![Tickets]![comboRequestor] and in the Message
Text I chose [Forms]![Tickets]![Problem].

I created a button on my Tickets form that runs this
macro. When I click it nothing happens. If I go to the
Macro list and run it from there, I get a message
saying "A program is trying to send an e-mail on your
behalf..." When I click yes I get an error message
saying "Unknown message recipient, the message was not
send".

Can someone help me with this?

Thanks,

Chuck
 
Create a button on your form and call it CmdMail. In the On Click Even
put the following code...

Code
-------------------

Private Sub CmdMail_Click()
On Error GoTo Err_CmdMail_Click

If IsNull(Me.ComboAssignedTo) Or IsNull(Me.comboRequestor) Or IsNull(Me.Problem) Then
MsgBox "Please Make Sure You Have Selected From Both Combo Boxes And There Is Text In The TextBox To Email."
Else
DoCmd.SendObject acSendNoObject, , , Me.ComboAssignedTo, , , Me.comboRequestor, Me.Problem, True
End If

Exit_CmdMail_Click:
Exit Sub

Err_CmdMail_Click:
Err.Clear
Resume Exit_CmdMail_Click

End Sub
 
Back
Top