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

VB coding with Access 1

Status
Not open for further replies.

Gvsandrs

Technical User
Aug 17, 2006
2
US
I have a report that needs to filter on sales reps from a query I created when I open the report, then email the filtered report per sales rep to that rep only. I set up the query initially to filter and prompt for sales rep name, however the number of salers reps have increased and I need to set the report to run automatically based on the query using recordset. Can someone help me?
 
I have tried and tried for days to get this to work. I'm running out of time. CAn some one please help me or give me a good starting point. the code i have below is to filter on a report for each sales rep name in a select query called "salesrepnames". Unfortunately it isn't working. The only way I'm getting it to filter is by placing the filter in the query ">60daytickler" that is the recordsource for the report. I need it to filter the recordsource when I open the report based on each sales rep in another query "salesrepnames". Desperate! the actual report name is "Nam_ticklerreport".




Private Sub Report_Open(Cancel As Integer)
Dim rst As ADODB.Recordset
Set rst = Sales_Rep

While Not rst.EOF
DoCmd.OpenReport , acViewPreview, rst, "sales_rep"
DoCmd.SendObject acSendReport, Nam_ticklerReport, pdf, "test@test1.com", , , Test, "sucess?", no
.MoveNext
Wend
End With

End Sub
 
From the above, it seems to me that this exercise may be beyond your current level of study. An advanced search in these fora should, I think, have got you a little further along the road than the above.
- You do not seem to have looked at the link JerryKlmns posted, which, if nothing else, would have shown how to open a recordset.
- The Access help files show the syntax for SendObject and OpenReport.
- You will find on the My Info page of Tek-Tips that management asks that you do not use emails.
- It seems that you wish to create a PDF and send it: you cannot do this with SendObject, however, once again an advanced search could help:
Access report to PDF file to Email: thread181-1172117
Save A Report As PDF: faq703-2533
Another link:
Good luck with your project.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top