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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help retrieving CR Version # inside RPT

Status
Not open for further replies.

CrystalMeister

Programmer
Apr 26, 2005
4
US
Hello all,

If this question has already been answered, I'll apologize for duplication and then please let me know where to find it.

I am using CR 11 Developer and VB6 to manually drive the RPT file. What I want to do is extract the CR version number that is stored in the RPT file that the report was designed under.

Thus, if someone created a report and they have CR8 on their PC, the RPT file will be saved as version CR8 (or CR9 or CR10 or CR11). My program has to open the file (using commands found in the Crystal Reports 11 version of CRAXDRT.DLL) and find out what the version number of the selected file was compiled/saved with. In this case I want to see the RPT file version as CR8.

I have a routine that accesses the ConnectionProperty collection of CRAXDRT from the report and I am able to retrieve the various info about how the report is connected to the database. But I really need to know what version of CR was used to save the file with. Perhaps I'm overlooking another property of the CR Report object I'm not aware of.

Any ideas?
 
I don't think there's a property that stores the version number, but if you're opening the reports with the CR 9 or higher components, you might be able to use the ConnectionProperties to check for any PREQE settings, but you'll have to include some error handling to get it right.

Here's a simple test app that seems to work for me, although I only tested it with a few reports:
Code:
Private Sub Form_Load()
Dim crxApp As New CRAXDRT.Application
Dim crxRpt As CRAXDRT.Report
Dim blnPreCR9Report As Boolean

On Error GoTo Conn_Prop_Err

blnPreCR9Report = True

'Open the report, and look at the PreQEServerName property
Set crxRpt = crxApp.OpenReport("c:\test85.rpt")
If crxRpt.Database.Tables(1).ConnectionProperties("PreQEServerName") = "" Then
    blnPreCR9Report = False
End If

If blnPreCR9Report Then 
    MsgBox "Pre CR9 Report"
Else
    MsgBox "Post CR8.5 Report"
End If

Exit Sub

Conn_Prop_Err:
    If Err.Number = 9 Then
        Resume Next
    End If
End Sub
-dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top