crystal report connect error with password-VBForums
Results 1 to 6 of 6

Thread: crystal report connect error with password

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2012
    Posts
    3

    crystal report connect error with password

    Hi guys ,

    this code is using to open crystal report from VB6 with database MSAccess but the problem is if there a password for the database this code will not working

    can anyone help me to correct to used it with password database

    Private Sub CmdPrn_Click()
    ServerSetup1 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & LocationFile & "\PSCData.mdb;Mode=ReadWrite|Share Deny None;Persist Security Info=False;;Jet OLEDBatabase Password=Mi40;"

    rpt1 = LocationFile & "\RptTrans.rpt"
    With MDIMain.CrystalReport1
    .ReportFileName = rpt1
    .Connect = ServerSetup1
    .DiscardSavedData = True
    .RetrieveDataFiles
    .ReportSource = 0
    .Destination = crptToWindow
    .PrintFileType = crptCrystal
    .WindowState = crptMaximized
    .WindowMaxButton = False
    .WindowMinButton = False
    .SelectionFormula = "{Trans.ProNum} ='" & TxtCaseNum.Text & "'"
    .Action = 1
    End With
    End sub

  2. #2
    Frenzied Member
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    2,044

    Re: crystal report connect error with password

    Here's how I do it,
    Code:
    Provider=Microsoft.Jet.OLEDB.4.0;Data Source=S:\Leave\Leave.mdb;Persist Security Info=True;User ID=admin;Jet OLEDB:Database Password=MYPWD
    Why is there a smiley face in your connection string?

  3. #3
    Frenzied Member
    Join Date
    May 2006
    Location
    some place in the cloud
    Posts
    1,863

    Re: crystal report connect error with password

    You are using an ado connection string, I don't think that's ok for CR
    I remember using something like the next
    Code:
    Dim MS  As String
    
    MS = “Driver={Microsoft Access Driver (*.mdb)};DBQ=" & LocationFile & "\PSCData.mdb;UID=sa;PWD=Mi40;”
    
    .Conect MS
    JG


    ... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...

  4. #4

    Thread Starter
    New Member
    Join Date
    Apr 2012
    Posts
    3

    Re: crystal report connect error with password

    thanks guy's

    by testing some of function i found it

    it's

    .password = chr(10) & (your password)

  5. #5

    Thread Starter
    New Member
    Join Date
    Apr 2012
    Posts
    3

    Re: crystal report connect error with password

    Quote Originally Posted by wes4dbt View Post
    Here's how I do it,
    Code:
    Provider=Microsoft.Jet.OLEDB.4.0;Data Source=S:\Leave\Leave.mdb;Persist Security Info=True;User ID=admin;Jet OLEDB:Database Password=MYPWD
    Why is there a smiley face in your connection string?


    that connection is working with ur ADO ,, but not working well with crystal

  6. #6
    Frenzied Member
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    2,044

    Re: crystal report connect error with password

    Yeah, that's because I never actually make CR connect to the database. I use my ADO .Net connection to create a dataset and then use that for my reports datasource.
    Code:
            taU.FillByUserIdRange(ds.users, Me.UserStartComboBox.Text, Me.UserEndComboBox.Text)
            taGrp.FillByNoDoubles(ds.groups)
            taL.FillByNoDoubles(ds.lots)
            taO.Fill(ds.owners)
    
            Dim rpt As New GroupsByUserId
            rpt.SummaryInfo.ReportTitle = clsCoInfo.CompName & vbNewLine & clsCoInfo.Address1
            rpt.SummaryInfo.ReportComments = "123 north street"
            rpt.SummaryInfo.ReportAuthor = "report author"
            rpt.SetDataSource(ds)
            frm.CrystalReportViewer1.ReportSource = rpt
            frm.ShowDialog()

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.