Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Database and Reporting > Printing Access Report from VB


Reply
 
Thread Tools Display Modes
  #1  
Old 11-27-2002, 12:12 PM
JerryEng JerryEng is offline
Junior Contributor
 
Join Date: Sep 2002
Location: Easley, SC
Posts: 201
Default Printing Access Report from VB


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?
Reply With Quote
  #2  
Old 11-27-2002, 01:19 PM
holtzy holtzy is offline
Senior Contributor
 
Join Date: Jul 2002
Location: USA
Posts: 1,041
Default

I think it can be done. Are you needing to pass the date variable from VB to Access?
__________________
God is good!!!
Reply With Quote
  #3  
Old 11-27-2002, 01:32 PM
JerryEng JerryEng is offline
Junior Contributor
 
Join Date: Sep 2002
Location: Easley, SC
Posts: 201
Default

Yes, I need to pass the date range from VB. The user will pick start and end date using datepickers.
Reply With Quote
  #4  
Old 11-27-2002, 01:57 PM
holtzy holtzy is offline
Senior Contributor
 
Join Date: Jul 2002
Location: USA
Posts: 1,041
Default

The one way I can think to do it is this. When they pick the date, use an update statement to write the date to a table in the Access database. Then have the Access report automatically pull from that table.
__________________
God is good!!!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->