How to use password protected Access in crystal reports with subreports
I am having a problem connecting the password protected access database with my crystal sub reports.
I am able to connect with crystal when there are no sub reports, but the problem arises when i use sub reports.
Somebody please help, thanx in advance.
How to use password protected Access in crystal reports with subreports
I am having a problem connecting the password protected access database with my crystal sub reports.
I am able to connect with crystal when there are no sub reports, but the problem arises when i use sub reports.
Somebody please help, thanx in advance.
I am reproducing the code below for your info.
Code:
MDIMain.Crl.Reset
MDIMain.Crl.Destination = crptToWindow
MDIMain.Crl.WindowShowExportBtn = True
MDIMain.Crl.WindowShowPrintSetupBtn = True
MDIMain.Crl.WindowShowZoomCtl = True
MDIMain.Crl.WindowShowCloseBtn = True
MDIMain.Crl.WindowShowNavigationCtls = True
MDIMain.Crl.WindowShowSearchBtn = True
MDIMain.Crl.WindowShowRefreshBtn = True
MDIMain.Crl.WindowShowCancelBtn = True
MDIMain.Crl.WindowShowProgressCtls = True
MDIMain.Crl.WindowState = crptMaximized
Set CrystalApplication = CreateObject("Crystal.CRPE.Application") Set CrystalReport = CrystalApplication.OpenReport(App.Path & "\Report\" & mPubReportName)
Set CrystalSections = CrystalReport.Sections
For Icr = 1 To CrystalSections.Count
Set CrystalSection = CrystalSections.Item(Icr)
Set CrystalReportObjects = CrystalSection.ReportObjects
For xcr = 1 To CrystalReportObjects.Count
If CrystalReportObjects.Item(xcr).Kind = crSubreportObject Then
Set CrystalSubReport = CrystalReport.OpenSubreport(CrystalReportObjects.Item(xcr).Name)
CrystalSubReport.FormulaFields.Item("AcYear").Text = "'" & "" & "'"
CrystalSubReport.FormulaFields.Item("RunDt").Text = "'" & "" & "'"
Set CrystalDatabase = CrystalReport.Database
Set CrystalTables = CrystalDatabase.Tables
For ycr = 1 To CrystalTables.Count
Set CrystalTable = CrystalTables.Item(ycr)
CrystalTable.Location = Apath & ".MDB"
Next
CrystalReport.FormulaFields.Item("CompName2").Text = "'" & mPubCompName2 & "'"
CrystalReport.RecordSelectionFormula = "{Advance.Type}='" & mPubType & "' and {Advance.SubCode}>='" & mPubcmbsCode & "' and {Advance.SubCode}<='" & mPubcmbeCode & "' and {Advance.Date}>=Date(" & Format(mPubmsksDate, "yyyy,mm,dd") & ") and {Advance.Date}<=Date(" & Format(mPubmskeDate, "yyyy,mm,dd") & ")"
Set SortFlds = CrystalReport.RecordSortFields
SortFlds.Add crAscendingOrder, "{Advance.Date}"
SortFlds.Add crAscendingOrder, "{Advance.DocNo}"
CrystalReport.Preview
Re: How to use password protected Access in crystal reports with subreports
what connection you used to create report
how are you calling it
if you are passing the password at run time then it shuld also pass to subreport
Re: How to use password protected Access in crystal reports with subreports
Re: How to use password protected Access in crystal reports with subreports
Quote:
Originally Posted by safetech
I am having a problem connecting the password protected access database with my crystal sub reports.
I am able to connect with crystal when there are no sub reports, but the problem arises when i use sub reports.
Somebody please help, thanx in advance.
Hai,
I using Crystal Report out of VB as a separate viewer and linking it through a crystal report controller.
I have problem linking with MS ACCESS database with password
Here is the Code how i connect it to crystal
Crp.Reset
Crp.DataFiles(0) = App.Path + "\" & MyCom.ID & "\Test.mdb"
Crp.ReportFileName = App.Path + "\Test.rpt"
Crp.WindowState = crptMaximized
Crp.Action = 1