Results 1 to 13 of 13

Thread: Crystal Report - Window Wont Show

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539
    Code:
    Private Sub Form_Load()
    Dim SQL As String
    
    SQL = "{Client016.Amps } = 10"
    
    With CP
    .Reset
    .DataFiles(0) = ("z:\electric meter department\meter\meter.mdb")
    .ReportFileName = (App.Path & "\report1.rpt")
    .WindowTitle = "Client Code Report"
    .WindowState = crptMaximized
    .WindowShowRefreshBtn = True
    .SelectionFormula = SQL
    .PrintReport
    .Destination = crptToWindow
    End With
    
    End Sub
    someone tell me whts wrong with my code?
    and yes the report has records in it that match criteria given..
    thank you

  2. #2
    Member
    Join Date
    May 2000
    Location
    Canada
    Posts
    52
    put .Destination = crptToWindow before .PrintReport

  3. #3

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539
    anyone?
    even this doesnt work
    Code:
    Dim SQL As String
    
    SQL = "{Client016.Amps } = 200"
    
    With CP
        .DataFiles(0) = ("z:\electric meter department\meter\meter.mdb")
        .ReportFileName = (App.Path & "\report1.rpt")
        '.WindowTitle = "Client Code Report"
        '.WindowState = crptMaximized
        '.WindowShowRefreshBtn = True
        '.SelectionFormula = SQL
        .Destination = crptToWindow
        .PrintReport
    End With
    it goes throu the code
    but shows nothing

  5. #5
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    You don't mention which methodology your using. OCX or RTDesigner. Assuming your using the OCX, you need to use Action=1. If you designed the report with no default printer, the report will not be printable at all. (It will display but the print button will do nothing). I think the method you are calling (.printreport) does just what it says..

    Most of the time I work with Crystal on the web..
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539
    Code:
    Private Sub Command1_Click()
    Dim SQL As String
    
    SQL = "{Client016.Amps } = 200"
    
    With CP
        .DataFiles(0) = ("z:\electric meter department\meter\meter.mdb")
        .ReportFileName = (App.Path & "\report1.rpt")
        .Action = 1
        .WindowTitle = "Client Code Report"
        .WindowState = crptMaximized
        .WindowShowRefreshBtn = True
        .SelectionFormula = SQL
        .Destination = crptToWindow
        .PrintReport
    End With
    
    End Sub
    yes i am using the ocx...
    no wi get error on .action =1 "unable to load report"
    and the report is there...

    also i have defualt printer..

  7. #7
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    I was thinking more like:
    Code:
    Private Sub Command1_Click()
    Dim SQL As String
    
    SQL = "{Client016.Amps } = 200"
    
    With CP
        .DataFiles(0) = ("z:\electric meter department\meter\meter.mdb")
        .ReportFileName = (App.Path & "\report1.rpt")
        .WindowTitle = "Client Code Report"
        .WindowState = crptMaximized
        .WindowShowRefreshBtn = True
        .SelectionFormula = SQL
        .Destination = crptToWindow
        .Action = 1
    End With
    
    End Sub
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  8. #8

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539
    i copied and pasted EXACTLY what you put in the last reply
    still get error on action =1
    the error is still "unable to load report"

  9. #9

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539
    i figured out why..
    i have crystal report 6 and 8 installed (8 was an update to 6)

    i just checked the version of ocx. its using the ocx for 6 not 8
    grr


  10. #10
    Guest

    Question Amazing, so it actually used the older version or

    ....did you select the wrong one from the components box? We get this occasionally with Agent 1 and 2. Is this a bug in vb?

  11. #11

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539

    i couldnt find ocx 8

    ocx for crystal report 8 didn't even exist
    thats we removed crystal report 6 trrying to install 8
    and that messed up other things..
    and now my computer has to be taken for maintanance again hehe
    stupid vb

  12. #12
    Frenzied Member Buzby's Avatar
    Join Date
    Jan 1999
    Location
    UK
    Posts
    1,670
    A top tip for Crystal Reports;

    Instead of doing

    Code:
    Report1.PrintReport
    Do

    Code:
    Dim Reply As Long
    Reply = Report1.PrintReport
    Then Reply contains the Crystal Error code (if there is one) or 0 if the report printed ok. Crystal is notoriously bad at displaying error messages (ie, it doesn't).

    'Buzby'
    Visual Basic Developer
    "I'm moving to Theory. Everything works there."

  13. #13
    Guest

    Thumbs up Thanks Mark we have started to use your tip

    Well another layer of error trapping....bring on vb7

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