JerryEng
11-27-2002, 12:12 PM
I have a Job Labor report based upon a query in Access that I'm trying to print from VB. The report displays total labor hours and labor cost (hours * cost) for the specified job number. The total hours are grouped by month (I told the query wizard in Access to generate a summary query).
I can print the report from VB if I specify only the job number:
appAcc.DoCmd.OpenReport "rptJobCostLabor", acViewNormal, , "[TimeSlips.JobNum] =" & strJobNum
What I would like to do is also limit the date range. There is a field in the query "Slip Date By Month: Format$(TimeSlips.SlipDate,'mmmm yyyy')". If I set the criteria of this field to "=?" in the Access query, I can run the report from Access and when I'm prompted to 'Enter Parameter Value ?', I can enter the date as "November 2002" and only labor for that month is shown.
The trouble is, I can't seem to call that field (Slip Date By Month)from VB. Ideally, I would like to enter a date range, e.g.
[TimeSlips.SlipDate] >= #date1# AND [TimeSlips.SlipDate] <= #date2#
Can this be done or am I going about the whole thing wrong?
I can print the report from VB if I specify only the job number:
appAcc.DoCmd.OpenReport "rptJobCostLabor", acViewNormal, , "[TimeSlips.JobNum] =" & strJobNum
What I would like to do is also limit the date range. There is a field in the query "Slip Date By Month: Format$(TimeSlips.SlipDate,'mmmm yyyy')". If I set the criteria of this field to "=?" in the Access query, I can run the report from Access and when I'm prompted to 'Enter Parameter Value ?', I can enter the date as "November 2002" and only labor for that month is shown.
The trouble is, I can't seem to call that field (Slip Date By Month)from VB. Ideally, I would like to enter a date range, e.g.
[TimeSlips.SlipDate] >= #date1# AND [TimeSlips.SlipDate] <= #date2#
Can this be done or am I going about the whole thing wrong?