Connecting Tech Pros Worldwide Help | Site Map

how to bind password protectec access to cr10 using vb6

Familiar Sight
 
Join Date: Jan 2007
Posts: 224
#1: Jan 7 '09
i want to use a password protected msaccess database with crytal reprot 10 and vb6 .
i had implemented the following code

Expand|Select|Wrap|Line Numbers
  1. - Add to Reference
  2. '1- Crystal Reports ActiveX Designer Run Time Library 10
  3. '2- Crystal ActiveX Report Viewer Library 10
  4. 'COMPATIBLE VERSION = CRYSTAL REPORT 10
  5.  
  6. Public CRReport As New CRAXDRT.Report
  7. Public CRApp As New CRAXDRT.Application
  8.  
  9. Public Sub CrysRpt(CrytalOCX As Object, RptPath As String, DBPath As String, DBPassword As String)
  10.  
  11. '-Assign Path to Report
  12. Set CRReport = CRApp.OpenReport(App.Path & RptPath)
  13.  
  14. On Error GoTo ExitLabel
  15.  
  16. With CRReport '-// Log-On to Database with Password Protect
  17.  
  18. '-//====================================
  19. .Database.Tables(1).SetLogOnInfo App.Path & DBPath, App.Path & DBPath, "", DBPassword
  20.  
  21. End With
  22.  
  23. With CrytalOCX
  24.  
  25. 'Set the source of Report viewer to the path of Report you made
  26. .ReportSource = CRReport
  27.  
  28. 'View/Display Report
  29. .ViewReport
  30.  
  31. End With
  32.  
  33. CRApp.CanClose
  34.  
  35. Exit Sub
  36.  
  37. ExitLabel: MsgBox Err.Number & " " & Err.Description, vbCritical
  38.  
  39. End Sub
  40.  
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

Expand|Select|Wrap|Line Numbers
  1. Call CrysRpt(CrytalOCX As Object, app.Path & "\test1.rpt", app.Path & "\Myproject.mdb","abc123" )
but getting error I am facing difficulty how to call this code.so how can i call this.what should i had to write.
Familiar Sight
 
Join Date: Jan 2007
Posts: 224
#2: Jan 7 '09

re: how to bind password protectec access to cr10 using vb6


I got the mistake i am making.so does not need any more assistance in it.

Thanks
Reply