Results 1 to 5 of 5

Thread: How to use password protected Access in crystal reports with subreports

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2007
    Location
    Mumbai, India
    Posts
    5

    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.

  2. #2

    Thread Starter
    New Member
    Join Date
    Sep 2007
    Location
    Mumbai, India
    Posts
    5

    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.

  3. #3
    Hyperactive Member yousufkhan's Avatar
    Join Date
    Jan 2002
    Location
    India
    Posts
    492

    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

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: How to use password protected Access in crystal reports with subreports

    Moved to reporting

  5. #5
    Lively Member
    Join Date
    Dec 2006
    Posts
    81

    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

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