Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

emailing current record (report) in html format 1

Status
Not open for further replies.

acarr2032

Programmer
Oct 4, 2004
18
0
0
US
I am trying to send this report by way of email in an HTML format, the problem is that its send all records instead of the current record on my form. Here is the code, can someone point me in the right direction to be able to email only the current record?

Private Sub Command90_Click()
On Error GoTo Err_Command90_Click

Dim stDocName As String

stDocName = "Sand"
DoCmd.SendObject acReport, stDocName

Exit_Command90_Click:
Exit Sub

Err_Command90_Click:
MsgBox Err.Description
Resume Exit_Command90_Click

End Sub




Thank you.
 
acarr2032
Wouldn't you have to make it that the query which populates your report is only showing the current record?

You could add to your DoCmd line in the code so that the report only pulls the specific record. Something such as...
Code:
DoCmd.SendObject acReport, stDocName, "[RecordID] = " & Forms!YourFormName!RecordID

Tom
 
Did not seem to work.

I did this same thing with a print out report, but when I try to apply this to the email report, it give me the error of "The format in which you are attempting to output the current object is not available".

I am stumped
 
Okay, here is what I found to work at this end. See if this does it for you...

Code:
DoCmd.OpenReport "YourReportName", acViewPreview, , "[RecordID] = " & Forms!YourFormName!RecordID
DoCmd.SendObject acSendReport, "YourReportName", acFormatHTML

It seems that if the report is prepared first, and the SendObject line follows, it will work.

Tom
 
That seemed to do the trick, I appreciate this very much, I can work with it from here.


Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top