I just put the email address in a textbox . . . and have a cmd button next to it with this code:
CODE
Private Sub cmdSendEmail_Click()
On Error GoTo Err_cmdSendEmail_Click
'----------------------------------------------------------------------------
'Started: 6/28/05
'
'
'
'
'
'
'----------------------------------------------------------------------------
If IsNull(txtConsultantEmail) Or txtConsultantEmail = "" Then
Dim lstrMsg As String
Dim lintResponse As Integer
lstrMsg = "Missing email address . . . send cancelled."
lintResponse = MsgBox(lstrMsg, vbOKOnly + vbInformation, "No Email Address")
Exit Sub
Else
On Error Resume Next '7/6/05
DoCmd.SendObject acSendNoObject, , , _
txtConsultantEmail, , , "Your subject text goes here", "Enter your message here ....", True
End If
Exit_cmdSendEmail_Click:
Exit Sub
Err_cmdSendEmail_Click:
DoCmd.Hourglass False
Dim lstrErrMsg As String
Dim lintErrResponse As Integer
lstrErrMsg = "Error has occured in frmConsultant_cmdSendEmail_Click. Please " & _
"advise System Administrator if problem persist. Error: " & Err.Number & " - " & _
Err.Description
lintErrResponse = MsgBox(lstrErrMsg, vbOKOnly + vbInformation, "Error")
Resume Exit_cmdSendEmail_Click
End Sub
I got this code from another poster here at this forum. Works fine . . .
If the email client isn't open, you get an error message . . .but after clicking OK, the email client opens anyway . . .and works as expected. Not sure how to surpress this message.
Steve