i want to use a password protected msaccess database with crytal reprot 10 and vb6 .
i had implemented the following code
what i am doing in making a module and starting my programe with sum main() and writing the above code in module.and calling it by followig the code
but getting error I am facing difficulty how to call this code.so how can i call this.what should i had to write.
i had implemented the following code
Code:
- Add to Reference '1- Crystal Reports ActiveX Designer Run Time Library 10 '2- Crystal ActiveX Report Viewer Library 10 'COMPATIBLE VERSION = CRYSTAL REPORT 10 Public CRReport As New CRAXDRT.Report Public CRApp As New CRAXDRT.Application Public Sub CrysRpt(CrytalOCX As Object, RptPath As String, DBPath As String, DBPassword As String) '-Assign Path to Report Set CRReport = CRApp.OpenReport(App.Path & RptPath) On Error GoTo ExitLabel With CRReport '-// Log-On to Database with Password Protect '-//==================================== .Database.Tables(1).SetLogOnInfo App.Path & DBPath, App.Path & DBPath, "", DBPassword End With With CrytalOCX 'Set the source of Report viewer to the path of Report you made .ReportSource = CRReport 'View/Display Report .ViewReport End With CRApp.CanClose Exit Sub ExitLabel: MsgBox Err.Number & " " & Err.Description, vbCritical End Sub
Code:
Call CrysRpt(CrytalOCX As Object, app.Path & "\test1.rpt", app.Path & "\Myproject.mdb","abc123" )
Comment