|
-
Sep 11th, 2007, 02:20 AM
#1
Thread Starter
New Member
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.
-
Sep 11th, 2007, 02:40 AM
#2
Thread Starter
New Member
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
Last edited by Hack; Sep 11th, 2007 at 05:37 AM.
-
Sep 11th, 2007, 04:31 AM
#3
Hyperactive Member
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
-
Sep 11th, 2007, 05:36 AM
#4
Re: How to use password protected Access in crystal reports with subreports
-
Sep 13th, 2007, 04:06 AM
#5
Lively Member
Re: How to use password protected Access in crystal reports with subreports
 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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|