I recently managed to find a code that displays the report for me. The code works fine when the database isn't password protected. But, when it comes to password protected, the code can't login. Any suggestions on how to modify the code to resolve that?

Here is the code I have:
VB Code:
  1. Option Explicit
  2. Dim strRecordsFormula As String
  3. Private Sub Form_Load()
  4.     Dim crReport As CRAXDRT.Report
  5.     Dim crApp As New CRAXDRT.Application
  6.  
  7.     'Open the Crystal Report
  8.     Set crReport = crApp.OpenReport(App.Path & "\RPSM.rpt")
  9.  
  10.     With crReport
  11.         'Set the Access database path
  12.    
  13.         .Database.Tables(1).Location = App.Path & "\YFDB.mdb"
  14.  End With
  15.     With CRView
  16.         .ReportSource = crReport
  17.         .ViewReport
  18.         While .IsBusy
  19.             DoEvents
  20.       Wend
  21.         .Visible = False
  22.         .Refresh
  23.     End With
  24.  
  25.     Set crApp = Nothing
  26.     Set crReport = Nothing
  27. End Sub