I have reports to display using Crystal Report 10.
To print it, the user has to push a button on vb which open a vb form called
CrViewer.
Since the source of the CR could be in a different location, im trying to make it load a db from a path that is saved into the db.
Private Sub Form_Load()
Dim lsSql As String
Dim lstr As String
Dim lDateDebut As Date
Dim lDateFin As Date
Dim lcFormulas As String
Dim liListcount As Integer
Dim lsPathBD As String
Dim lvRapportId As Variant
Dim llPeriodePaye As Long
Dim lCrxApplication As CRAXDRT.application
Dim lRapportCrystal As CRAXDRT.Report
Dim lCrxDatabaseField As CRAXDRT.DatabaseFieldDefinition
Dim i As Long
Set lCrxApplication = New CRAXDRT.application
Set lRapportCrystal = lCrxApplication.OpenReport(ObtenirRepertoireRapport() & "RapportAdmRemboursementCumul.rpt", crOpenReportByTempCopy) ' OptenirRepertoirRapport() is a function that return the path to the report directory that is saved in the database.
' Finds the path from the registry...
lsPathBD = GetSetting("GTS", "Demarrage", "RepertoireBD", "")
lRapportCrystal.DiscardSavedData
For i = 1 To lRapportCrystal.Database.Tables.Count
lRapportCrystal.Database.Tables(i).Location = lsPathBD
Next i
frmCRViewer.CRViewer.ReportSource = lRapportCrystal
CRViewer.ViewReport
Set frmCRViewer = Nothing
Set lCrxDatabaseField = Nothing
Set lRapportCrystal = Nothing
Set lCrxApplication = Nothing
End Sub
The problem is encounter when the Crystal Report is opening. it Open but then I get the Error "Erreur, Non Implment" with "Crystal Report Viewer" as title for the errmsg.
Im using Visual Basic 6.0 (SP6)
Windows XP Home, French (SP2)
Crystal Report 10.0.5.1025 Dev. Full, French
Any Help would be Appreciated.the properties of the Database are:
OLE DB (ADO)
Microsoft.Jet.OLEDB.4.0
C:\Projet\Simoneau\DB\DB.mdb
Access
1033
-6
Admin
When using the Crystal Report Tool, no error are popping up but when calling the command
CRViewer.ViewReport The Error pop's up.
I have download a sample from Planet Source
http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=59818&lngWId=1
It also work fine using the Access/Excel(DAO) database source but if I change it to Microsoft.Jet.OLEDB.4.0 it keep giving me that same error.
Is there anyway to go around this error msg and display my report using Microsoft.Jet or do i have to use Access/Excel DAO absolutely ?
Monday, March 19, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment