I feel foolish for posting this question but I don't get to program often enough over the past few years to remember how to do much of anything. What I'm trying to do is to use the info in a field to run a query, which is the backbone of a report. The input table would be something like:
Date Work Order
11/1/07 123456
11/2/07 987654
I want to take the Work Order number to open a report multiple times to print info related to each Work Order. I've written the report and started the module below:
Function DoIt()
Dim WoNum As String
Dim k As String
Set rs = CurrentDb().Ope nRecordset("WOs in Date Range") ' this is the table above
varValues = rs.GetRows(999)
rs.Close
intFieldCount = UBound(varValue s, 1)
intRowCount = UBound(varValue s, 2)
For j = 0 To intRowCount
i = 0
k = varValues(i, j)
Debug.Print k
I'm struggling to figure out how to use the value I just put in k as the criteria in the query behind the report I'm trying to print. There's probably a better way but what I think I want to do is to open the report using the first Work Order value, print it, close it, then open the same report again using the second Work Order, etc.
I'd appreciate any help I can get on this. I've wasted a couple of hours so far on this simple task.
Date Work Order
11/1/07 123456
11/2/07 987654
I want to take the Work Order number to open a report multiple times to print info related to each Work Order. I've written the report and started the module below:
Function DoIt()
Dim WoNum As String
Dim k As String
Set rs = CurrentDb().Ope nRecordset("WOs in Date Range") ' this is the table above
varValues = rs.GetRows(999)
rs.Close
intFieldCount = UBound(varValue s, 1)
intRowCount = UBound(varValue s, 2)
For j = 0 To intRowCount
i = 0
k = varValues(i, j)
Debug.Print k
I'm struggling to figure out how to use the value I just put in k as the criteria in the query behind the report I'm trying to print. There's probably a better way but what I think I want to do is to open the report using the first Work Order value, print it, close it, then open the same report again using the second Work Order, etc.
I'd appreciate any help I can get on this. I've wasted a couple of hours so far on this simple task.
Comment