By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,933 Members | 1,243 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,933 IT Pros & Developers. It's quick & easy.

Select Statement to GET email address and send mail?

P: n/a
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

Dec 29 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
I answered this about 3 weeks ago. Have a search, you'll find it.

te********@hotmail.com wrote:
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
Dec 29 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.