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 only current record

Status
Not open for further replies.

ejmiller2

Programmer
Jun 3, 2003
38
US
Hello all...ive read other threads of people trying to do this, but they all seem psuedo code...nothing i can really grasp dealing with this.

I want to send a report attached to an e-mail, but i only want the person to see a specific report...based upon their ID number. I have the report made called contracts. here is my code for sending

DoCmd.SendObject acSendReport, "Contract", acFormatRTF,_ TTo, CC, "", Subject, Msg, False

Contract is the name of the report...but it attaches all contracts...i would like to limit it by whatever mean neccesary, perhaps a query, or a direct select statement?...

thanks,
eric
 
You could creata a function, used in the record source of the report, that will check the value of TTo, and only return those records that match that person.
 
thanks...this seems like a good method, the only problem is that i also use the report for other things, the only time i want it to only open the TTo restriction is when i e-mail. this means i would have to make two reports, one for sending e-mail and one for the other uses. Although this works, it seems like there should be an easier way. i will have to do this until i find otherwise...what i'm kinda looking for is currently i could use

DoCmd.OpenReport stDocName, acViewPreview, , WhereCondition:=Me.Filter

where i could filter by TTo. But this only opens the correct contract. Is there anyway i could just "create" the actual report behind the screens restricted to TTo, then e-mail that one, then delete it so i can use a loop to do all e-mail.

 
Hello everyone, i figured it out without actually creating a new report...

i used the above do command and filterd it the way i wanted.
then i used the e-mail line from the msg one above the openreport one, after that i had to make sure to close the report before looping and sending another one....

hope thats understandable

eric
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top