Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
Password Reminder
Register
Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
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?
Reply With Quote
Reply


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 05:19 PM
JET database Engine and Access georgizas Classic ASP Databases 2 November 3rd, 2004 02:52 AM



All times are GMT -4. The time now is 07:00 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.