Send Object....

fireman_gcfd

Registered User.
Local time
Yesterday, 21:34
Joined
Aug 14, 2007
Messages
25
Hello everyone. I am having a little difficulty in finding out exactly where I went wrong with this script. Everything works...sort of. The idea of it was to email a Single record. When clicking the button it wants to send All the reports. I am able to generate a report showing only one record, but trying to get the same thing but prepare it for email does not seem to be working.

Here is my code...can you see where I went wrong?

Private Sub Command304_Click()
On Error GoTo Err_Command304_Click
Dim strWhere As String
Dim stDocName As String
stDocName = "MyReport"

If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If

If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to email"
Else
MyForm = "[Incident] = """ & Me.[Incident] & """"
DoCmd.SendObject acReport, "MyReport", "Snapshot Format", , , , "My email Report " & Me.[Date]
Exit_Command304_Click:
Exit Sub

Err_Command304_Click:
MsgBox Err.Description
Resume Exit_Command304_Click
End If

End Sub

Thanks again

Jaz
 
You can't limit records with SendObject like you can with OpenReport, if that's what you're trying to do. You'd have to do it in the report itself.
 
So in using OenReport, is there a way of viewing and emailing all at the same time? Such as report opens with a request for emailing message? (i.e. "send message to email now?")

Cheers

Jaz
 
If you want to email a restricted report, you'll need to do the restricting in the report. Common methods are either referring to a form with the source query, or setting a filter in the open event.

You can certainly view then email. I create a custom toolbar that opens with the report, allowing the user to click a button to email the report.
 
A toolbar you say?? That sounds like an excellent idea! Could you point me in the right direction as to how to accomplish this? It would be greatly appreciated. These are not restricted reports but need to be sent on an idividual basis once filled out.

thanks again
Jaz
 

Users who are viewing this thread

Back
Top Bottom