[RESOLVED] Database password in VB6 for CR 10
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:
Option Explicit
Dim strRecordsFormula As String
Private Sub Form_Load()
Dim crReport As CRAXDRT.Report
Dim crApp As New CRAXDRT.Application
'Open the Crystal Report
Set crReport = crApp.OpenReport(App.Path & "\RPSM.rpt")
With crReport
'Set the Access database path
.Database.Tables(1).Location = App.Path & "\YFDB.mdb"
End With
With CRView
.ReportSource = crReport
.ViewReport
While .IsBusy
DoEvents
Wend
.Visible = False
.Refresh
End With
Set crApp = Nothing
Set crReport = Nothing
End Sub
Re: Database password in VB6 for CR 10
Try this...
VB Code:
With crReport
.Database.Tables(1).Location = App.Path & "\YFDB.mdb"
.Database.Tables(1).SetSessionInfo "", Chr$(10) & "your password"
Re: Database password in VB6 for CR 10