Error 20534 when running Crystal Reports from a VB 4.0 program

Posted on 1997-10-30
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 ?


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

Accepted Solution

thomaskramer earned 200 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"


Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

808 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