Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
| Search | Today's Posts | Mark Forums Read
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 19th, 2004, 06:08 PM
Registered User
 
Join Date: Sep 2003
Location: Edmonton, , Canada.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Access as a report engine...

I have an app written in VB6 using an MDB as a database. What I want to do is use access as a report designer and report engine however I'm having difficulties with it.

Basically I'm launching reports with the following code:

Code:
    Dim acApp         As Access.Application

    acApp.OpenCurrentDatabase "C:\MyDB.mdb"
    Call acApp.DoCmd.OpenReport(strReportName, vbViewPreview)
    acApp.DoCmd.Maximize
    acApp.Visible = True
Now this works although there are a few issues. Issue #1, It just runs the query that the report is linked to. you can pass in a query name if you like but it does not handle paramaters (which 99% of my query's have).

So as a work around ... I use this code to overwrite the query text each time.

Code:
    strSQL = "SELECT blah blah blah ... WHERE blah='%s'"
    strSQL = Replace(strSQL, "%s", intParamID)

    Dim db As DAO.Database
    Dim qd As DAO.QueryDef
    Set db = OpenDatabase("C:\MyDB.mdb")
    Set qd = db.QueryDefs("QueryName")
Now some of you might be shaking your head muttering tsk tsk .. trust me i've done this countless times ... this solution works, but not very well.

Basically I'm finding that if data is being updated while someone prints a report, it causes a corruption of the MDB. users opening new connections receive an "Unrecognized format" exception... at which point I open the mdb, repair and it's ready to go. doing this a couple times a week is obviously unacceptable .. so i'm looking for a better solution.

Any suggestions?




Similar Threads
Thread Thread Starter Forum Replies Last Post
Access Report from Access PivotTable Form Odeh Naber Access 2 July 24th, 2007 09:33 AM
Access, ASP, DWMX & Search engine help. malhyp Dreamweaver (all versions) 2 August 30th, 2005 05:26 AM
Access Report akibaMaila VB.NET 2002/2003 Basics 0 January 17th, 2005 06:19 PM
JET database Engine and Access georgizas Classic ASP Databases 2 November 3rd, 2004 03:52 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.