Thank you in advance for guide me.
I have a tabel called Agency_Hours The unique field is employer. My current script creates the PDF report with all the Employer totals, I think I need to validate if the employer is new.
Here is my code:
Private Sub Label315_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim MyFileName As String
Dim mypath As String
Dim temp As String
mypath = "W:\Agency_Reports\"
Set db = CurrentDb()
Set rs = db.OpenRecordset("SELECT [Employer] FROM [Agency_Hours]", dbOpenDynaset)
Do While Not rs.EOF
temp = rs("Employer")
MyFileName = rs("Employer") & ".PDF"
' set the Me.cboName as filter for your report
DoCmd.OpenReport "timecard_agency_daterange_TZ", acViewReport, "me.[employer] = ' " & [temp] & " ' "
DoCmd.OutputTo acOutputReport, "", acFormatPDF, mypath & MyFileName
DoCmd.Close acReport, "Agecy Report to PDF"
rs.MoveNext
Loop
Set rs = Nothing
Set db = Nothing
End Sub
I have a tabel called Agency_Hours The unique field is employer. My current script creates the PDF report with all the Employer totals, I think I need to validate if the employer is new.
Here is my code:
Private Sub Label315_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim MyFileName As String
Dim mypath As String
Dim temp As String
mypath = "W:\Agency_Reports\"
Set db = CurrentDb()
Set rs = db.OpenRecordset("SELECT [Employer] FROM [Agency_Hours]", dbOpenDynaset)
Do While Not rs.EOF
temp = rs("Employer")
MyFileName = rs("Employer") & ".PDF"
' set the Me.cboName as filter for your report
DoCmd.OpenReport "timecard_agency_daterange_TZ", acViewReport, "me.[employer] = ' " & [temp] & " ' "
DoCmd.OutputTo acOutputReport, "", acFormatPDF, mypath & MyFileName
DoCmd.Close acReport, "Agecy Report to PDF"
rs.MoveNext
Loop
Set rs = Nothing
Set db = Nothing
End Sub