Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Dynamically Linking reports for our customers

Posted on 2004-09-22
14
Medium Priority
?
344 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
How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

 
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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

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 …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

618 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