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!

Report to Filter each employer to create induvial PDF reports

Status
Not open for further replies.

lmcate

MIS
Jan 17, 2012
36
US
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
 
Is there any field in your Agency_Hours table that states if the Employer is new or not?

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
Hi Andrzejek:

Thank you, Actually I have a query I would like to use instead of the table (Agency_Hours). I just did the table because this is what I know.

the query is called timecard_by_employer so I have 5 companies and my query makes 5 pdf's with all the information for all the employers

The fields are:
Emmployee,Employer,team,start_date,end_date,total hours_worked

the key field is Employer.

Thanks,

Sam

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top