Results 1 to 6 of 6

Thread: error in viewing a report

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2005
    Posts
    150

    Question error in viewing a report

    hi,,

    i have this code for viewing a report from my application but when i run the program and click on the report buttin i get this error:
    report not found..

    the kine colored in red is the one that i get the error in:
    Code:
    Private Sub Command1_Click()
    
    
        CrystalReport1.ReportFileName = App.Path & "rent.rpt"
        CrystalReport1.DiscardSavedData = True
        CrystalReport1.RetrieveDataFiles
       
    
        CrystalReport1.ReportSource = 0
        CrystalReport1.SQLQuery = "select * from rent order by {serial}"
        CrystalReport1.WindowTitle = "Rent system"
        CrystalReport1.Destination = crptToWindow
        CrystalReport1.PrintFileType = crptCrystal
        CrystalReport1.WindowState = crptMaximized
        CrystalReport1.SelectionFormula = "IsNull({Document.rent})"
        CrystalReport1.Action = 1
    
    End Sub
    any help please?

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: error in viewing a report

    App.Path does not include an ending \ (unless the app is in the root directory of a drive). Add a \ to the file name.

    CrystalReport1.ReportFileName = App.Path & "\rent.rpt"

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Apr 2005
    Posts
    150

    Re: error in viewing a report

    i did what you told me and i get this error :
    error in formula the error is in red)

    Code:
    Private Sub Command1_Click()
    
    
        CrystalReport1.ReportFileName = App.Path & "\rent.rpt"
        CrystalReport1.DiscardSavedData = True
        CrystalReport1.RetrieveDataFiles
        
    
        CrystalReport1.ReportSource = 0
        CrystalReport1.SQLQuery = "select * from rent order by {serial}"
        CrystalReport1.WindowTitle = "Rent system"
        CrystalReport1.Destination = crptToWindow
        CrystalReport1.PrintFileType = crptCrystal
        CrystalReport1.WindowState = crptMaximized
        CrystalReport1.SelectionFormula = "IsNull({Document.rent})"
        CrystalReport1.Action = 1
    End Sub

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Apr 2005
    Posts
    150

    Re: error in viewing a report

    can someone help me please?

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: error in viewing a report

    What is the code for your formula?

    That would appear to be what Crystal doesn't like, but as I don't know what that code is, I can't, at the moment, offer any suggestions.

  6. #6
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: error in viewing a report

    You specified Document.Rent in the formula. Document is the table name and Rent is the field name. Document is not a table in your Selection formula. Rent is however.

    Should the formula be

    CrystalReport1.SelectionFormula = "IsNull({Rent.rent})"

    or

    CrystalReport1.SelectionFormula = "IsNull({Rent.????? Some other field})"

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