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 OLEDB:Database 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
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?
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
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)
Re: crystal report connect error with password
Quote:
Originally Posted by
wes4dbt
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
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()