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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

send current record by email in report format

Status
Not open for further replies.

rcpbaby1

MIS
Apr 22, 2005
13
GB
Hi,
any help for this newbie question is appreciated:

I have a button to create a preview report of the current record as follows:

Private Sub reportPV_Click()
Dim strDocName As String
Dim strWhere As String
strDocName = "Warehouse_Incident_table"
strWhere = "[Incident Number]=" & Me![Incident Number]
DoCmd.OpenReport strDocName, acViewPreview, ,strWhere
End Sub

If I copy the syntax of above to send the current report via attachment e.g.:

Private Sub SendRpt_Click()

Dim strDocName As String
Dim strWhere As String
strDocName = "Warehouse_Incident_table"
strWhere = "[Incident Number]=" & Me![Incident Number]
DoCmd.SendObject acReport, strWhere

End Sub

I get an error 'run time error 2103, the report name [incident number]=1 you entered in the property sheet or macro is misspelled or refers to a report that doesn't exist.

I know there something basic and fundementally wrong with the code but am stumped(sorry if this is a little basic, we all started somewhere! lol).

rcp
 
Place your cursor inside the SendObject word in your code and the press the F1 key.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
not sure if I'm heading in the right direction but could you give me an idea how wrong the following is:

DoCmd.SendObject acSendReport, strDocName, strWhere

thanks
RCP
 
Have you read the help about the SendObject method of the DoCmd object ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
yes but it doesn't specify(or I can't see) the condition for the where=current ID. This works fine:

DoCmd.SendObject acSendReport, strDocName

but when the... strWhere is added it fails. Am stumped :(

RCP
 
Where in the help have you seen a strWhere argument for this method ?
 
are you saying it doesn't exist ? if not how would I go about sending the current record as an email attachment?

TIA
RCP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top