Hello,
My issue is that I have a form and report that are required to be printed out daily and each sheet must presently be selected by the individual record to have the forms print because they use a SQL SELECT TOP 40 to generate the data set based on the employee's number.
That SQL statement is :
strSQL = "SELECT TOP 40 [Job Table].[KMA Job #], [Job Table].[Job Completion Notes], [Job Table].[Asg Unit], Right([kma job #],1) AS Event, Left([kma job #],2) AS Stuff, Left([Job Description],3) AS estTrk FROM [Job Table] INNER JOIN Customer ON [Job Table].Customer = Customer.Customer WHERE (((Customer.Type) = 'Residential')) GROUP BY [Job Table].[KMA Job #], [Job Table].[Asg Unit], Right([kma job #],1), Left([kma job #],2), Left([Job Description],3), [Job Table].[Job Completion Notes] HAVING ((([Job Table].[Asg Unit])=" & stData & ") AND ((Left([Job Description],3))='est')) ORDER BY [Job Table].[KMA Job #] DESC;"
where stData is equal to the unit number of the employee which is selected from a combobox on the form. The selects the last 40 jobs for an employee.
The query (qryTechNumber) that I want to pull the data from looks like:
Unit
20
25
28
32
My employer wants to push a single button and have all of the forms/reports print out in sequence. The employee's change frequently so I need to build the form in such a way that I don't have to modify the underlying code to make it work.
What I need is a method that will take the data from that query at place it into the stData field and print the form. I can handle the SQL and the looping equation, but what I cannot figure out is how to get the data from the query and place it into a method that I can place into the stData field.
Because I am using "SELECT TOP" in my SQL statement I cannot simply make a big master report with all the employees and I need to generate it on a per employee basis.