Results 1 to 3 of 3

Thread: [RESOLVED] Database password in VB6 for CR 10

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cairo, Egypt
    Posts
    275

    Resolved [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:
    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

  2. #2
    Frenzied Member pnish's Avatar
    Join Date
    Aug 2002
    Location
    Tassie, Oz
    Posts
    1,918

    Re: Database password in VB6 for CR 10

    Try this...
    VB Code:
    1. With crReport
    2.     .Database.Tables(1).Location = App.Path & "\YFDB.mdb"
    3.     .Database.Tables(1).SetSessionInfo "", Chr$(10) & "your password"
    Pete

    No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cairo, Egypt
    Posts
    275

    Re: Database password in VB6 for CR 10

    Spot on. Thanks man.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width