|
-
Sep 21st, 2005, 10:41 AM
#1
Thread Starter
New Member
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:
' DBName = BudgetBlinds3.mbd
' Table = M_Receipt
' Crystal Report File = Receipt.rpt
Private Sub Command1_Click()
With CrystalReport1
.WindowShowZoomCtl = True
.WindowControlBox = False
.PageZoom (200)
.WindowShowExportBtn = True
.WindowShowPrintBtn = True
.WindowShowPrintSetupBtn = True
.WindowShowRefreshBtn = True
.WindowShowCloseBtn = True
.WindowShowGroupTree = False
.WindowState = crptMaximized
.PageZoom (200)
.WindowTitle = "Report Title "
.ReportFileName = "D:\DS Project\ProjectVB\Tests\TestCrystal\Receipt.rpt"
.Connect = "D:\DS Project\ProjectVB\Tests\TestCrystal\BudgetBlinds3.mdb"
.RetrieveDataFiles
.Action = 1
End With
End Sub
Edit: Added [vbcode][/vbcode] tags for clarity. - Hack
-
Sep 21st, 2005, 10:45 AM
#2
Re: Slight Crystal report Prob
-
Sep 21st, 2005, 12:42 PM
#3
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:
Private Sub Command1_Click()
Dim lngTotalFiles As Long
Dim lngIdx As Long
With CrystalReport1
.WindowShowZoomCtl = True
.WindowControlBox = False
.PageZoom (200)
.WindowShowExportBtn = True
.WindowShowPrintBtn = True
.WindowShowPrintSetupBtn = True
.WindowShowRefreshBtn = True
.WindowShowCloseBtn = True
.WindowShowGroupTree = False
.WindowState = crptMaximized
.PageZoom (200)
.WindowTitle = "Report Title "
.ReportFileName = "D:\DS Project\ProjectVB\Tests\TestCrystal\Receipt.rpt"
' .Connect = "D:\DS Project\ProjectVB\Tests\TestCrystal\BudgetBlinds3.mdb"
' .RetrieveDataFiles
lngTotalFiles = .RetrieveDataFiles
For lngIdx = 0 To lngTotalFiles - 1
.DataFiles(lngIdx) = "D:\DS Project\ProjectVB\Tests\TestCrystal\BudgetBlinds3.mdb"
Next
.Action = 1
End With
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|