hi
below is some code that someone helped me with in a different database and works great
but I want to modify it to another database , the new one does not have a field called status with the result " active "
si i dont know how to modifyy it i have attached the new database i am trying to use for you. can you please have a look and help me change it to send a report to each supplier just with thier outstanding Po
you will see a drop down box on the form , please select "outstandingpoby supplier
thanks you
below is some code that someone helped me with in a different database and works great
but I want to modify it to another database , the new one does not have a field called status with the result " active "
si i dont know how to modifyy it i have attached the new database i am trying to use for you. can you please have a look and help me change it to send a report to each supplier just with thier outstanding Po
you will see a drop down box on the form , please select "outstandingpoby supplier
thanks you
Code:
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
Wend
End With
End If