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

Emailing a Report with Criterias

Status
Not open for further replies.

ZeoGel

Technical User
May 13, 2003
28
US
I am having trouble getting a report to email that have criteras. I am trying the below code but keep getting an Object required error. Any suggest are welcome

Private Sub Command9_Click()
On Error GoTo Err_Command9_Click

Dim stDocName As String
Dim stLinkCriteria As String
Dim stManager As String

stManager = "[Manager Email] = " & " '" & subfrmExamsavg![mgrEmail] & "'"
stLinkCriteria = "[Class]=" & Chr(34) & Me![Class] & Chr(34) & " AND [Manager]= " & Chr(34) & Me![Manager] & Chr(34)

stDocName = "rptExamsavg"

DoCmd.ApplyFilter qryExamsavg!stDocName, stLinkCriteria
DoCmd.SendObject acSendReport, stDocName, A_FORMATRTF, stManager, , , "DFT 104 Exam Grades", "If there is any questions, Please feel free to call or email me."

Exit_Command9_Click:
Exit Sub

Err_Command9_Click:
MsgBox Err.Description
Resume Exit_Command9_Click

End Sub
 
I have tried by inputing in the criteria section of the query itself, problem is it keeps asking for the criteria even when i specify it.
 
Hi

I am having to guess here, but the code you posted is in the onclick event of a command button. That button is presumably on a form. Have you tried putting textbox controls (or appropriate control types) on the form, to gather the critera and including those controls in the query as the criteria (you can use the builder for this)

????

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top