I'm using this code for my DataBase, if you understand it will help you..if
you have another question please reply.
Private Sub EMailRptBtn_Click()
On Error GoTo ErrHandler
Dim rpt As Report
Dim sRptName As String
Dim sMsg As String
Dim stdomail As String
sRptName = "rptSingleOrder"
sMsg = "Please confirm if this Order Quotation is correct with " & _
"Product Name, Descripción & price!!"
stdomail = Me![SupplierID].Column(2) 'This column has the e-mail address
DoCmd.OpenReport sRptName, acViewDesign
Set rpt = Reports(sRptName)
rpt.RecordSource = "SELECT * " & _
"FROM [OrdersQueryInvoice1] " & _
"WHERE (OrderID = " & Me!OrderID.Value & ");"
DoCmd.Close acReport, sRptName, acSaveYes
DoCmd.SendObject acSendReport, sRptName, acFormatSNP, _
stdomail, , , "Order Quotation", sMsg, True
CleanUp:
Set rpt = Nothing
Exit Sub
ErrHandler:
If (Err.Number <> 2501 And Err.Number <> 2046) Then ' User didn't
cancel E-Mail.
MsgBox "Error in EMailRptBtn_Click( ) in" & vbCrLf & _
Me.Name & " form." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & vbCrLf & Err.Description
End If
Err.Clear
GoTo CleanUp
End Sub
--
Lorenzo DÃ*az
Cad Technician
"Sheria" wrote:
> Hi, I am having a problem with my email request button that I added to my
> subform. I am creating a database for our customer service team and one of
> the functions that they need is a Email Button. So i created an Email Request
> button, the problem that i am running across is when I am inputting
> information into a clients account and i want to send that account, i press
> the email request button but instead of sending just that one account all the
> accounts are being sent through the email system. When i first started
> working on this database i had the email button working when it was just on a
> form, but when i updated the database and created a sub form the email
> request button will not send one client. If someone could lend me a helping
> hand it would be great appreciated. Below is a copy of the program
>
> Function Email_frmInsReq()
>
> 'Emails form results to A-Team Staff
>
> On Error GoTo Email_frmInsReq_Err
> DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
> DoCmd.SendObject acSendForm, "subfrmInsReq", acFormatHTML, , , , _
> "Self Pay Database Request", "This is an automated e-mail message
> created by the Self Pay Database." _
> , False
>
> Email_frmInsReq_Exit:
>
> Exit Function
>
> Email_frmInsReq_Err:
>
> Thanks you
> Sheria
> MsgBox Error$
> Resume Email_frmInsReq_Exit
>
> End Function
|