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

migrating from vb cr9 to vb cr XI

Status
Not open for further replies.

brews

Technical User
Dec 12, 2007
194
0
0
US
Been using cr 9 & vb6 for a time. Tried to install the program on to a 64 bit machine and received error msg 30005 when trying to use the reports. All other functions on the form that are not associated with crystal reports work fine.

So I thought I would try cr xi. Ran into a couple of problems that have me puzzled. The reports I am using are internal (.dsr) to vb6. I am trying to print name tags with pictures in cr xi but the picture is the same for all irrespective if the record calls for one.

This code works in cr9:
Code:
Private WithEvents crSection As CRAXDRT.Section
Private cn As New ADODB.Connection
Private rs As New ADODB.Recordset
Private cmd As New Command
Private Report As New crNameTagsInsert

Private Sub crSection_Format(ByVal pFormattingInfo As Object)

        Set crSection.ReportObjects("Classmate").FormattedPicture = _
        LoadPicture(crNameTagsInsert.Sections("DetailSection3").ReportObjects("PicFile").Value)
crSection_Format_Exit:
    Exit Sub
End Sub

Private Sub Form_Load()
    'Insert name tag sort by last name
    Dim sSearch As String
    Set crSection = crNameTagsInsert.Sections("DetailSection1") 'Insert Name badge
    mdiMain.sbStatusBar.Panels(2) = vbNullString
    Screen.MousePointer = vbHourglass
    If cn.State = adStateOpen Then
        cn.Close
    End If
    cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
           "Data Source=" & App.Path & "\School.rlc;" & _
           "User Id=admin;" & _
           "Password="

    Set cmd.ActiveConnection = cn
    cmd.CommandType = adCmdText
    cmd.CommandText = "SELECT FirstName, LastName, MaidenName, ClassYear, ClassPhoto," & _
                       " ClassYear as SortYear, Lastname AS SortName, 1 AS SortOrder" & _
                       " FROM Members INNER JOIN Attending ON Members.ID = Attending.ID" & _
                       " Where numAttend > 0" & _
                       " UNION ALL SELECT Spouse, LastName, Null, Null, Null, Classyear, Lastname, 2" & _
                       " FROM Members INNER JOIN Attending ON Members.ID = Attending.ID" & _
                       " Where numAttend > 1" & _
                       " ORDER BY SortYear, SortName, SortOrder"

    rs.CursorLocation = adUseClient
    rs.CursorType = adOpenDynamic
    Set rs = cmd.Execute
    crNameTagsInsert.DiscardSavedData
    crNameTagsInsert.Database.SetDataSource rs
    crNameTagsInsert.ReadRecords
    With CRViewer1
        .Refresh
        .ReportSource = Report
        .ViewReport
        .Zoom (60)
        .EnableExportButton = False
        .DisplayTabs = False
        .EnableGroupTree = False
        .EnableCloseButton = False
    End With
End Sub

Don't know why the outcome should change from one version to another using the same code.

Any ideas would be great.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top