hi,
this is some code tht I found and modified to suit me own reports etc
how can I change it so it send the e-mail without asking me to press the send button in outlook
thanks steve
this is some code tht I found and modified to suit me own reports etc
how can I change it so it send the e-mail without asking me to press the send button in outlook
Code:
im strCriteria As String
Dim thisCriteria As String
Dim eMail As String
Dim Title As String
Dim Message As String
Dim i As Integer
DoCmd.OpenForm FormName:="ReportDialog", WindowMode:=acDialog
'* check if [TextReportOption] <> 0
If Me.TextReportOption <> 0 Then
strCriteria = "(1=1)" '(1=1) means it is always True, therefore returns all records
Select Case Me.TextReportOption
Case Is = 1 'Print Preview
'* Open the report with criteria
DoCmd.OpenReport REPORTNAME:=cboReports, VIEW:=acViewReport, WHERECONDITION:=strCriteria
Case Is = 2 'Print
'* Open the report with criteria
DoCmd.OpenReport REPORTNAME:=cboReports, VIEW:=acViewNormal, WHERECONDITION:=strCriteria
Case Is = 3 'Email report
If cboReports = "Open Issues" Then
strCriteria = "[STATUS]=""ACTIVE"""
If DCount("1", "Issues", "Status=""Active""") <> 0 Then
With CurrentDb.OpenRecordset("SELECT DISTINCT [Assigned To] FROM [Issues] " & _
"WHERE [Status]=""Active""")
If Not (.BOF And .EOF) Then .MoveFirst
i = 0
While Not .EOF
i = i + 1
thisCriteria = strCriteria & " And [Assigned To]=" & Nz(.Fields(0).Value, 0)
eMail = DLookup("[E-mail Address]", "Contacts", "ID=" & Nz(.Fields(0).Value, 0))
'* close report if already open
If SysCmd(acSysCmdGetObjectState, acReport, cboReports.Value) <> 0 Then
DoCmd.Close acReport, cboReports.Value
End If
DoCmd.OpenReport REPORTNAME:=cboReports, VIEW:=acViewPreview, WHERECONDITION:=thisCriteria
'* this is a test
'* DoCmd.OutputTo acOutputReport, cboReports.Value, acFormatPDF, Environ("userprofile") & "\documents\rpt" & i & ".pdf", True
DoCmd.SendObject acSendReport, cboReports.Value, acFormatPDF, eMail, , , "Open Issues", _
"Your prompt action is required for the following issues!"
DoCmd.Close acReport, cboReports.Value
.MoveNext
thanks steve