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


Reply
 
Thread Tools Display Modes
  #1  
Old 03-29-2004, 02:37 PM
timeless timeless is offline
Newcomer
 
Join Date: Mar 2004
Posts: 3
Question Access Report from VB


Hello all. I'm having an issue with my vb app calling out an access report, I hope someone can help me out. I created a vb6 application that runs a report that is available in access. The original access report has a query that uses a date range to display the records. When I run the report from the vb app it runs the date range query twice. Is there something I'm forgetting to do?
Here's the code for it:

Public Sub cmdReport_Click()
On Error Resume Next
Set appAccessReport = New Access.Application
SnapShotFile = App.Path & "1.snp"
SnapShotFile = Replace(SnapShotFile, "/", "-")

appAccessReport.OpenCurrentDatabase ("\\Mainserver\Shared Drive\Time Sheets\Reports.mdb")
appAccessReport.DoCmd.OutputTo acOutputReport, "rptTimeSheet", acFormatSNP, SnapShotFile, 0
frmReport.snpReport.SnapshotPath = SnapShotFile
appAccessReport.DoCmd.OpenReport "rptTimeSheet", acViewPreview
frmReport.Show
appAccessReport.Quit

Set appAccessReport = Nothing
End Sub

The access query just has "Between [Enter Starting Date] And [Enter Ending Date]" within the criteria section. Thanks in advance.
Reply With Quote
  #2  
Old 03-29-2004, 05:58 PM
MKoslof's Avatar
MKoslof MKoslof is offline
Cum Grano Salis

Retired Moderator
* Guru *
 
Join Date: Jul 2002
Location: Baltimore, Maryland
Posts: 14,636
Default

You are also instantiating the report object TWICE. First you output the report to a snapShotFile, which fires your criteria and then you open the report again in ViewPreview mode, which also fires the criterion.
__________________
"Artificial Intelligence is no match for natural stupidity." ~unknown
Reply With Quote
  #3  
Old 03-29-2004, 07:24 PM
Evadman Evadman is offline
Centurion
 
Join Date: Dec 2003
Location: Illinois
Posts: 113
Default

__________________
IBM Attachmate Guru. PM me if you have Attachmate Session automation questions.
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Access report via vb PeterUKVB General 1 07-18-2003 08:26 AM
Passing parameter from a VB application to an Access report. clonboy Database and Reporting 1 02-26-2003 06:59 PM
Report from access to vb app dejota6 Database and Reporting 3 01-08-2003 01:29 PM
Calling an Access report from VB 6 - MAXIMIZED!! Aminal General 1 01-06-2003 07:17 PM

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
 
 
-->