Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Error 20534 when running Crystal Reports from a VB 4.0 program

Posted on 1997-10-30
1
Medium Priority
?
229 Views
Last Modified: 2006-11-17
I am developing in MS VB 4.0 under MS DOS 6.22 & MS Windows 3.1.1.My application calls 5 Crystal Reports which run over an MS Access database with no problem. These reports do not have any selection criteria - they provide summary information over the whole of the tables they refer to. However, I have two other reports which do have selection criteria, set within the VB code. The application runs OK on the development PC, but when I use the VB Setup Wizard to produce a set of installation disks and install the application on a user's PC, running these two reports gives the above error.

Please find attached the VB code which calls the CRs.

**********************************************************
Public Sub ReportHandler(report As Integer)
**********************************************************
Dim dummy As String

    Select Case report
        Case 1
            frmMDI_Insurance.CrystalReport1.ReportFileName = ".\opnclms.rpt"
        Case 2
            frmMDI_Insurance.CrystalReport1.ReportFileName = ".\sixweek.rpt"
        Case 3
             frmMDI_Insurance.CrystalReport1.ReportFileName = ".\depttype.rpt"
        Case 4
            frmMDI_Insurance.CrystalReport1.ReportFileName = ".\reserved.rpt"
        Case 5
            frmMDI_Insurance.CrystalReport1.ReportFileName = ".\settle.rpt"
        Case 6  {one case which gives the error}
            frmMDI_Insurance.CrystalReport1.ReportFileName = ".\Crawlet.rpt"
            dummy = Chr(39) + grsClaimDetails("RBC_REF") + Chr(39)
            frmMDI_Insurance.CrystalReport1.SelectionFormula = "{qryMailMerge.RBC_REF}=" + dummy
        Case 7 {the second case which gives the error}
            frmMDI_Insurance.CrystalReport1.ReportFileName = ".\Claimlet.rpt"
           ' Call LogFile("After setting the reportname to Claimlet")
            dummy = Chr(39) + grsClaimDetails("RBC_REF") + Chr(39)
          '  Call LogFile("After building Dummy")
            frmMDI_Insurance.CrystalReport1.SelectionFormula = "{qryMailMerge.RBC_REF}=" + dummy
           ' Call LogFile("After setting the report selection formula")
    End Select
   
    frmMDI_Insurance.CrystalReport1.Destination = 0
 '   Call LogFile("After setting the report destination")
    frmMDI_Insurance.CrystalReport1.Action = 1
{the following line is not executed -> the error occurs on the Action of the report}
 '   Call LogFile("After setting the report Action")
   
End Sub

Any ideas ? Anything I can check/am (not) doing ?

Regards,

Simon Hall, Redditch Borough Council, Worcestershire, UK.
0
Comment
Question by:gog
1 Comment
 

Accepted Solution

by:
thomaskramer earned 400 total points
ID: 1439232
I think you have to re-set the DataFiles property of the crystal report control in your code, because it is stored in the report. When opening the report from vb, crystal report searches the database in the old directory. So write something like this:

CrystalReport1.DataFiles(0) = "c:\new\first.mdb"


0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question