Results 1 to 8 of 8

Thread: resetting a crystal report control in code?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 1999
    Location
    Brisbane, Qld, Australia
    Posts
    78

    Question

    Hi,

    I want to know if it is possible to reset the crystal reports control as I recieve an error when I try to swap between tables. What this means is that when i access 1 report using one table it loads the report but when i access anothter report with a different table it comes up with an error. Is there a command or code that will reset the control therefore allowing you to swap between tables.

    Mike

  2. #2
    Fanatic Member
    Join Date
    Nov 2000
    Location
    Worldwide in the Sun
    Posts
    566
    Try this


    I think of 2 solutions:

    1. create a second CR control OR

    2. change the CR properties by coding

    sample: CrystalReport1.Datasource = your datasource
    CrystalReport1.ReportFileName = your report


    Hope this will help

    Cheers
    Ray
    Ray

  3. #3
    Addicted Member
    Join Date
    Apr 1999
    Posts
    178
    Try this

    Public Sub reSetDataFiles()

    'This procedure is run before printing any Crystal Reports document.
    'It takes care of the 20506 error.

    frmMain.reportMain.DataFiles(0) = ""
    frmMain.reportMain.DataFiles(1) = ""
    frmMain.reportMain.DataFiles(2) = ""
    frmMain.reportMain.DataFiles(3) = ""
    frmMain.reportMain.DataFiles(4) = ""
    frmMain.reportMain.DataFiles(5) = ""
    frmMain.reportMain.DataFiles(6) = ""
    frmMain.reportMain.DataFiles(7) = ""
    frmMain.reportMain.DataFiles(8) = ""
    frmMain.reportMain.DataFiles(9) = ""
    frmMain.reportMain.DataFiles(10) = ""

    End Sub

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jun 1999
    Location
    Brisbane, Qld, Australia
    Posts
    78
    Marex,

    Thanks but that doesn't work. The error I am getting is:

    error "-214741848(80010108)"
    Method 'Action' of object "CrystalCtrl" failed

    Anyone else got ideas?


  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jun 1999
    Location
    Brisbane, Qld, Australia
    Posts
    78
    Sorry Ken,
    That doesn't work either.

    I have gone to microsoft and got the latest dev kit 2.6 and still no difference. I am using two forms but the first form uses one table and the other form uses the other.

    I need them to run that way but there must be some way to fix the problem. I am using a form parameter though.

    Mike

  6. #6
    Fanatic Member
    Join Date
    Nov 2000
    Location
    Worldwide in the Sun
    Posts
    566
    Hmmm

    Very strange, I have many applications with more than
    one CR control, no problems at all.
    If you run the report from within CR itself, is it working
    fine or not?
    Which version of CR do you have, I'm using Version 7.
    How is your coding inside the VB application.
    Ones I had a problem, could'nt find anything, and just deleted the control and remaked it.


    Cheers
    Ray
    Ray

  7. #7
    Fanatic Member Gary.Lowe's Avatar
    Join Date
    May 2000
    Location
    In my sphere of influence
    Posts
    621
    Try putting a DoEvents before the ViewReport method of the control.

    I have had problems before when trying to open another report after one has been opened.

    It seems it is still processing when tring to view the new data.

    Don't know if this will help but it's worth a try
    Gary Lowe
    VB6 (Enterprise) SP5
    ADO 2.6
    SQL Server 7 SP3

    OK I know my spelling and grammer is crap so don't quote me on it!

    To err is human to take the P! is only natural !!

    Click on the top section of image for Marcus Miller website and bottom section of image for 'Run For Cover' sound clip


  8. #8
    Lively Member
    Join Date
    Aug 2001
    Posts
    83

    Run-time error 2147417848

    Spawny,

    Getting the exact same error. Were you ever able to figure out solution? Response greatly appreciated.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width