?
Solved

Dynamically Linking reports for our customers

Posted on 2004-09-22
14
Medium Priority
?
343 Views
Last Modified: 2012-06-27
Hi, my first question as a newly joined member

we have developed an application running on sql server, vb6 using crystal 8.5

what would be the best way to distribute the reports to our customers and relink to their respective databases through code rather than how we do presently - we relink the reports manually through a remote dial up connection from our support desk

have looked at a quite a lot of previously asked questions but its seems that unless we pass recordsets through to the reports (which we will probably move to over time) there is not any other choice open to us

Cheers
0
Comment
Question by:consultsgp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
  • 3
14 Comments
 
LVL 13

Assisted Solution

by:vidru
vidru earned 2000 total points
ID: 12127696
Here's an approach I've used for several applications:

In the path of the application, there resides a Reports folder containing the .rpt files.  At runtime, a Reports menu is created dynamically, adding each report found in the Reports folder as a menu item.  When a report menu item is clicked, a Report object is created and sent to a VB form with a CRViewer component.  In the Viewer form's code, you can re/set the report's logon info at runtime (for a code sample, see http://www.tek-tips.com/faqs.cfm?fid=5374).

Using this method, you'd only have to transfer over the .rpt files, and the application would take care of the 'linking' at runtime.

-dave
0
 

Author Comment

by:consultsgp
ID: 12149791
Hi Dave

Have followed this to the letter but my system comes up with a system error
&H80004005 (-2147467259)?

Any ideas as to what could cause this - is it a license issue even though I have the Crystal 8.5 developers license?

Cheers
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 13

Expert Comment

by:vidru
ID: 12149807
Is the error message any more specific than that?  If you step through the code, what causes the error?

If you can, post the code you're using, and we'll have a look.

-dave
0
 

Author Comment

by:consultsgp
ID: 12149815
Hi Dave

Exactly as typed:
'--------------------------
Option Explicit
Dim crxApp As New Application
Dim crxRpt As CRAXDRT.Report
Dim crxTables As CRAXDRT.DatabaseTables
Dim crxTable As CRAXDRT.DatabaseTable
Dim crxSubreportObject As CRAXDRT.SubreportObject
Dim crxSubReport As CRAXDRT.Report
Dim crxSections As CRAXDRT.Sections
Dim crxSection As CRAXDRT.Section

Private Sub Form_Load()
'Variable declarations
Dim strServerOrDSNName As String
Dim strDBNameOrPath As String
Dim strUserID As String
Dim strPassword As String
Dim i As Integer, j As Integer


strServerOrDSNName = "KorrectK"
strDBNameOrPath = "KorrectK"
strUserID = "sa"
strPassword = ""

'Open the report
Set crxRpt = crxApp.OpenReport("C:\Korrect\Reports\Double Moon\025 TrackList.rpt")

'Set the connection for the report.
crxRpt.Database.Tables(1).SetLogOnInfo strServerOrDSNName, _
    strDBNameOrPath, strUserID, strPassword

'This removes the schema from the Database Table's Location property.
Set crxTables = crxRpt.Database.Tables
For Each crxTable In crxTables
    With crxTable
         .Location = .Name
    End With
Next

'Loop through the Report's Sections to find any subreports, _
    and change them as well
Set crxSections = crxRpt.Sections

For i = 1 To crxSections.Count
    Set crxSection = crxSections(i)

    For j = 1 To crxSection.ReportObjects.Count

        If crxSection.ReportObjects(j).Kind = crSubreportObject Then
            Set crxSubreportObject = crxSection.ReportObjects(j)

            'Open the subreport, and treat like any other report
            Set crxSubReport = crxSubreportObject.OpenSubreport
            Set crxTables = crxSubReport.Database.Tables

            For Each crxTable In crxTables
                With crxTable
                    .SetLogOnInfo strServerOrDSNName, _
                        strDBNameOrPath, strUserID, strPassword
                    .Location = .Name
                End With
            Next

        End If

    Next j

Next i

'View the report
Viewer.ReportSource = crxRpt
Viewer.ViewReport


End Sub

'--------------------------

Done this in a new project with just the following:
Components: Crystal Report Viewer Control
References: Crystal Reports 8.5 ActiveX Designer Run Time Library
Crystal Report Viewer Control

Many thanks Again
0
 
LVL 13

Expert Comment

by:vidru
ID: 12149858
The code tests fine.

Again, if you step through the code, where does the error happen, and is it more descriptive than just the error code (-2147467259)?

-dave
0
 

Author Comment

by:consultsgp
ID: 12149934
Hi

whenever I try to save the form it just comes up with this error
0
 
LVL 10

Expert Comment

by:anv
ID: 12149944
error occurs 'coz of duplicate values
being entered into the database...
0
 

Author Comment

by:consultsgp
ID: 12150111
Hi Anv

Getting a bit confused here as it seems to throw the error before hitting any database

We do set up the same DSN as the database name hence the KorrectK being repeated - is this what you meant?

Many thanks
0
 

Author Comment

by:consultsgp
ID: 12150223
The error happens when we try to save the form?
0
 
LVL 13

Accepted Solution

by:
vidru earned 2000 total points
ID: 12150583
Try doing a Google search for: &H80004005 (-2147467259) system error visual basic

I don't know what's going on, but have a look at the search results to see if anything looks relevant.  I'm going to be in an out all day getting ready for another goofy hurricane, but I'll check in periodically.

-dave
0
 

Author Comment

by:consultsgp
ID: 12151450
Hi Dave

It is something to do with the Riched32.dll which is usually installed when exchange is implemented - given that I run remote exchange seems a bit odd but have managed to resolve the issue and your code works a treat

Thanks for all of your help and hope the hurricane does not affect anyone

Will send over the points

Cheers
Simon
0
 
LVL 13

Expert Comment

by:vidru
ID: 12151936
Thanks Simon, and glad I could help.

-dave
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question