I am trying to add a cmdButton to an Access form. I would like to
click the button, look up an email address in a database table, and
execute Outlook with that email address ready to send an email.
Has anyone tried this?
Code thus far - SELECT fails to fill strSQL variable with the email
address:
Private Sub cmdEmailSend_Click()
Dim Db As Database
Dim strSql As String
Dim txtLName As TextBox
Set Db = CurrentDb()
'Set txtLName = Me.txtLName
strSql = ("SELECT Email" & " FROM Contact" & " WHERE LName = " &
[Forms]![frmReports]![txtLName] & "")
DoCmd.SendObject acSendNoObject, , , strSql, , , , , -1
End Sub