A
AnnieV via AccessMonster.com
I have a form with multiple records and I want to be able to e-mail the most
current record by clicking on an “E-mail Order†command button. Using the
help I found here I added this code so I could view the most current (just
entered) record in a report:
Private Sub email_cmd_Click()
On Error GoTo Err_email_cmd_Click
Dim stDocName As String
strCriteria = "[ItemID] = " & Me!ItemID
DoCmd.OpenReport "Current Work Order Request", acViewPreview, ,
strCriteria
Exit_email_cmd_Click:
Exit Sub
Err_email_cmd_Click:
MsgBox Err.Description
Resume Exit_email_cmd_Click
End Sub
So now I can see the report with the most current record but I also want to
be able to e-mail this report when this command button is clicked….I’d really
like to just be able to get the last record and e-mail the report without the
view step. I tried adding a DoCmd.SendObject line to this but keep getting an
error. I also tried doing the e-mail via a macro step but I kept e-mailing
myself a blank version of the report. Can someone help me? What is the best
way to accomplish this?
Annie
current record by clicking on an “E-mail Order†command button. Using the
help I found here I added this code so I could view the most current (just
entered) record in a report:
Private Sub email_cmd_Click()
On Error GoTo Err_email_cmd_Click
Dim stDocName As String
strCriteria = "[ItemID] = " & Me!ItemID
DoCmd.OpenReport "Current Work Order Request", acViewPreview, ,
strCriteria
Exit_email_cmd_Click:
Exit Sub
Err_email_cmd_Click:
MsgBox Err.Description
Resume Exit_email_cmd_Click
End Sub
So now I can see the report with the most current record but I also want to
be able to e-mail this report when this command button is clicked….I’d really
like to just be able to get the last record and e-mail the report without the
view step. I tried adding a DoCmd.SendObject line to this but keep getting an
error. I also tried doing the e-mail via a macro step but I kept e-mailing
myself a blank version of the report. Can someone help me? What is the best
way to accomplish this?
Annie