Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set Location Problem

Status
Not open for further replies.

trmoney

Programmer
May 2, 2001
15
US
We currently have a Visual Basic application into which we've imported a number of Crystal 8.5 Reports (as DSRs using CRViewer), in order to make them part of the VB executable (thereby eliminating the need for Crystal Reports being installed on the user workstation).

The problem is that these reports' locations are all pointing to the Development environment's SQL Server. To promote the VB app to QA, then to Production, we have to re-point the reports to the QA, then Production, SQL Servers, respectively. The only way we have to do this is to re-open the Visual Basic application and (re)Set Location on each of the Crystal reports now residing within the VB app. This compromises the proper method of promotion, which is to promote the application components to each new level (QA, then Production) WITHOUT modification.

How can we do this without having to modify and rebuild the VB app at each promotion level? I understand that there is a third-party product called Object Manager, from APS Systems, Inc., but APOS' documentation doesn't mention whether it will work with the VB-based components.
 
Tomoney

If I understand you correctly, you are wanting to have the crystal report connect to a different SQL server with out having to recompile the report?

if so, try this as a solution ( I tend to use external RPT files though..)

Code:
Dim crxRep As CRAXDRT.Report
Dim crxApp As CRAXDRT.Application
Dim sReport As String
Dim sMsg As String
Dim lDiffs As Long

sReport = app.path & "\MyReport.rpt"

Set crxApp = New CRAXDRT.Application
Set crxRep = crxApp.OpenReport(sReport, 0)
' you will need to set crxApp = new MyReport if you use DSR

Me.MousePointer = vbHourglass

With crxRep.Database.Tables.Item(1)
    .ConnectionProperties("Data Source") = g_sServerName
    .CheckDifferences lDiffs       'Ensures server is valid
End With
[code]

If I understand it correctly, setting the connection property for the first table will be enough

[code]
If (lDiffs And crTDServerNotFound) = False Then
    
    'Server is OK
Else
    'Server Not Found
end if
with CRViewer91
   .ReportSource = crxRep
   .ViewReport
end with

.show report
' Clean up object
    Set crxRep = Nothing
    Set crxApp = Nothing

I hope this offers some glimmer of a solution. Have currently got g_sServername as a global variable, which could be read from the registry on startup.

If this doesn't work, let me know and I'll try and help...Please though bear in mind that I only started with crystal 9 this week and I only worked out this code last night...
Take Care

Matt
If at first you don't succeed, skydiving is not for you.
 
oh Bu**er,

I forgot to set the mousepointer back to vbDefault...


The perils of cut and paste... Take Care

Matt
If at first you don't succeed, skydiving is not for you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top