×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Business Objects: Crystal Reports 2 Data Access FAQ

Opening Subreport and Logon

How do I use SetLogonInfo to logon to the subreport when the subreport might be on a different database by balves
Posted: 26 Mar 02

' Using RDC components and Visual Basic
' Open the main report
' Then find the subreport and open it
' Logon to the subreport

Dim Report As CRAXDRT.Report
Dim SubReport As CRAXDRT.Report
Dim App As CRAXDRT.Application
Dim Sections As CRAXDRT.Sections
Dim Section As CRAXDRT.Section
Dim RepObjs As CRAXDRT.ReportObjects
Dim SubReportObj As CRAXDRT.SubreportObject
Dim n As Integer
Dim i As Integer
Dim j As Integer

  Set App = New CRAXDRT.Application
  Set Report = App.OpenReport("your.rpt")

  For n = 1 To Report.Database.Tables.Count
    Report.Database.Tables(n).SetLogOnInfo "server", "dbname", "user", "pass"
  Next n

  Set Sections = Report.Sections
  For n = 1 To Sections.Count
    Set Section = Sections.Item(n)
    Set RepObjs = Section.ReportObjects
    For i = 1 To RepObjs.Count
      If RepObjs.Item(i).Kind = crSubreportObject Then
         Set SubReportObj = RepObjs.Item(i)
         Set SubReport = SubReportObj.OpenSubreport
         For j = 1 To SubReport.Database.Tables.Count
            SubReport.Database.Tables(j).SetLogOnInfo "server", "db", "username", "pass"
         Next j
      End If
    Next i
  Next n

Back to Business Objects: Crystal Reports 2 Data Access FAQ Index
Back to Business Objects: Crystal Reports 2 Data Access Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close