Solved

Error 20534 when running Crystal Reports from a VB 4.0 program

Posted on 1997-10-30
1
218 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 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"


0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now