Results 1 to 3 of 3

Thread: Slight Crystal report Prob

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2005
    Posts
    15

    Slight Crystal report Prob

    Hello out there,

    I am using VB6, Crytal Reports 8.5 and Access 2003. The following is the code i have done and keep on getting error 20599 "Cannot open SQL Server". What is happening. Also if i substitute relative paths for the absolute paths of my Databse and Crytal Report files i get "Invalid File Name".

    This is the code i am using :
    VB Code:
    1. ' DBName = BudgetBlinds3.mbd
    2. ' Table = M_Receipt
    3. ' Crystal Report File = Receipt.rpt
    4.  
    5. Private Sub Command1_Click()
    6.  
    7. With CrystalReport1
    8.    .WindowShowZoomCtl = True
    9.    .WindowControlBox = False
    10.    .PageZoom (200)
    11.    .WindowShowExportBtn = True
    12.    .WindowShowPrintBtn = True
    13.    .WindowShowPrintSetupBtn = True
    14.    .WindowShowRefreshBtn = True
    15.    .WindowShowCloseBtn = True
    16.    .WindowShowGroupTree = False
    17.    .WindowState = crptMaximized
    18.    .PageZoom (200)
    19.    .WindowTitle = "Report Title "
    20.    .ReportFileName = "D:\DS Project\ProjectVB\Tests\TestCrystal\Receipt.rpt"
    21.    .Connect = "D:\DS Project\ProjectVB\Tests\TestCrystal\BudgetBlinds3.mdb"
    22.    .RetrieveDataFiles
    23.        
    24.    .Action = 1
    25.    
    26. End With
    27.    
    28. End Sub


    Edit: Added [vbcode][/vbcode] tags for clarity. - Hack


  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Slight Crystal report Prob

    Moved.

  3. #3
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Slight Crystal report Prob

    The Connect property is used to specify an ODBC DSN, not a file name.

    You need to first retrieve the report's data files, which populates the DataFiles array. Then change the array element to the correct database file. I have no problems using UNC paths.

    VB Code:
    1. Private Sub Command1_Click()
    2.     Dim lngTotalFiles As Long
    3.     Dim lngIdx As Long
    4.  
    5. With CrystalReport1
    6.    .WindowShowZoomCtl = True
    7.    .WindowControlBox = False
    8.    .PageZoom (200)
    9.    .WindowShowExportBtn = True
    10.    .WindowShowPrintBtn = True
    11.    .WindowShowPrintSetupBtn = True
    12.    .WindowShowRefreshBtn = True
    13.    .WindowShowCloseBtn = True
    14.    .WindowShowGroupTree = False
    15.    .WindowState = crptMaximized
    16.    .PageZoom (200)
    17.    .WindowTitle = "Report Title "
    18.    .ReportFileName = "D:\DS Project\ProjectVB\Tests\TestCrystal\Receipt.rpt"
    19. '   .Connect = "D:\DS Project\ProjectVB\Tests\TestCrystal\BudgetBlinds3.mdb"
    20. '   .RetrieveDataFiles
    21.  
    22.     lngTotalFiles = .RetrieveDataFiles
    23.        
    24.     For lngIdx = 0 To lngTotalFiles - 1
    25.          .DataFiles(lngIdx) = "D:\DS Project\ProjectVB\Tests\TestCrystal\BudgetBlinds3.mdb"
    26.     Next
    27.        
    28.    .Action = 1
    29.    
    30. End With
    31.    
    32. End Sub

    However, since you have Crystal 8.5, I would recommend that you use the newer "Crystal Report Viewer Control" in conjunction with the Crystal Reports 8.5 ActiveX Runtime Library.

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