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!

Adding a where clause to "SendObject" 1

Status
Not open for further replies.

nim180

IS-IT--Management
Aug 11, 2005
161
AU
Hi everyone,

I want to send an email using sendobject but i want to add a Where criteria to it. for example i have:

stDocName = "Invoice"
Job = Me!Job_Number
DateR = Me!Date_Requested
strToWhom = InputBox("Enter recipient's e-mail address.", _
"Enter Email Address")

DoCmd.SendObject acSendReport, stDocName, ".rtf", strToWhom, , , " Job Number " & Job & " Requested " & DateR

This works fine but it brings up all the records for the report "Invoice", i want to be able to filter a single record to email instead all of the records. I have the following but not sure where to insert it.

stLinkCriteria = "[Job_Number]=" & "'" & Me![Job_Number] & "'"

The first job number refers to the field on the report and the second refers to the field on the form. Whatever record is shown on the form i want that to be filtered on the report so i can send the individual record. Hope that makes sense. Any Suggestions would be great.

Regards,
Nim

 
One way would be to modify the record source of the report so it refers to a query that refers to the current form. The SQL of the query would look something like this:

[tt]SELECT InvNo, Amount, Etc FROM tblInvoices
WHERE Job_Number=Forms!frmForm!Job_Number[/tt]
 
hmmmm didnt even think of that, thanks Remou ill give it a shot.

Nim
 
Thanks Remou Worked perfectly

nim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top