Results 1 to 3 of 3

Thread: [RESOLVED] object doesn't support this action! HELP!

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2012
    Posts
    47

    Resolved [RESOLVED] object doesn't support this action! HELP!

    hello guys! just got some problem generating a crystal report with SQL server as database and vb6 as backend. Whenever i call the report for the "FIRST" time, the error doesn't appear however when i try to generate the report again, the above error appears. Pls give me some hints pls. Below is my code:

    Code:
        Call LoadReport
    
        Screen.MousePointer = vbHourglass
        CRViewer91.ReportSource = Report
        CRViewer91.ViewReport
        Screen.MousePointer = vbDefault
    
        '   Set Report Group Section
        Set oSectionGH = Report.Sections("D") 'this where the error occurs.
    Code:
    Private Sub oSectionGH_Format(ByVal pFormattingInfo As Object)
    
    
    
        If Dir(App.Path & "\" & oSectionGH.ReportObjects(2).Value & ".jpg") <> "" Then
            Set oSectionGH.ReportObjects.Item("picImage").FormattedPicture = LoadPicture(App.Path & "\" & oSectionGH.ReportObjects(2).Value & ".jpg", vbLPCustom, vbLPColor)
        Else
    
            Set oSectionGH.ReportObjects.Item("picImage").FormattedPicture = LoadPicture(App.Path & "\" & "blank.jpg", vbLPCustom, vbLPColor)
        End If
    End Sub

    Code:
    Sub LoadReport()
        Dim strConnString As String
        strConnString = vbNullString
        strConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\" & "NWIND.mdb;Persist Security Info=False"
    
        Set Crystal = New CRAXDRT.Application
        Set Report = New CRAXDRT.Report
        Set adoRec = New ADODB.Recordset
        
        With adoRec
            .ActiveConnection = strConnString
            .CursorLocation = adUseClient
            .CursorType = adOpenKeyset
            .LockType = adLockReadOnly
            .Source = "SELECT * FROM CUSTOMERS"
            .Open
        End With
    
        Set Report = Crystal.OpenReport(App.Path & "\" & "sample.rpt", 0)
        
        
        With Report
            .DiscardSavedData
            .Database.SetDataSource adoRec
            .VerifyOnEveryPrint = True
        End With
    End sub
    Last edited by dexjel140503; Jul 19th, 2013 at 12:30 AM.

  2. #2
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: object doesn't support this action! HELP!

    Do you unload the report before trying to generate it again? Try putting

    vb Code:
    1. Set oSectionGH = Nothing

    at the end of your code and see if the problem happens again.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2012
    Posts
    47

    Re: object doesn't support this action! HELP!

    That does the trick! Thanks night! Thumbs up for you!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width