Opening a new email with the "TO" filled in from a field

R

radink

Hey all,

I wanted to be able to hit a command button that would take the email
address from a field in access and put it into the to field of a new
email in outlook. I can't seem to find just what i need to do this.

Thanks!
Mark
 
B

Bill Mosca

Will this do? I included the error trap in case the user closes the email
without sending it.

Private Sub Command25_Click()

On Error GoTo err_PROC
'Get address from text box
DoCmd.SendObject To:=Me.txtEmailTo

exit_PROC:
On Error Resume Next
Exit Sub

err_PROC:
Dim strErrMsg As String
Dim lngIconBtn As Long

Select Case Err.Number
Case 2501
'Open cancelled. Ignore error
Case Else
strErrMsg = Err.Description
lngIconBtn = vbCritical
End Select

If strErrMsg <> "" Then MsgBox strErrMsg, lngIconBtn, _
"Error!"

Resume exit_PROC


End Sub
 
Top