Results 1 to 9 of 9

Thread: Save Crystal Report in VB

  1. #1

    Thread Starter
    Lively Member claire99's Avatar
    Join Date
    Nov 2002
    Location
    OH
    Posts
    66

    Save Crystal Report in VB

    I get an error when I run the code below. Does anyone know what's wrong with my code. Thanks a lot!
    Error message:
    compile error
    argument not optional

    My code:
    Dim Report As New CrystalReport1

    Private Sub Form_Load()
    Screen.MousePointer = vbHourglass
    CRViewer1.ReportSource = Report
    CRViewer1.ViewReport
    Screen.MousePointer = vbDefault
    Report.SaveAs ("C:\Documents and Settings\test.rpt")
    End Sub

    Private Sub Form_Resize()
    CRViewer1.Top = 0
    CRViewer1.Left = 0
    CRViewer1.Height = ScaleHeight
    CRViewer1.Width = ScaleWidth
    End Sub

  2. #2
    Fanatic Member
    Join Date
    Apr 2002
    Posts
    638
    you need to specify a file format:

    VB Code:
    1. Report.SaveAs ("C:\Documents and Settings\test.rpt", cr80FileFormat)

  3. #3

    Thread Starter
    Lively Member claire99's Avatar
    Join Date
    Nov 2002
    Location
    OH
    Posts
    66

    new error message

    Thanks! But another error message showed:
    compile error
    syntax error

    Do you have any idea?

    claire

  4. #4
    Fanatic Member
    Join Date
    Apr 2002
    Posts
    638
    on what line?

  5. #5

    Thread Starter
    Lively Member claire99's Avatar
    Join Date
    Nov 2002
    Location
    OH
    Posts
    66
    Report.SaveAs ("C:\Documents and Settings\test.rpt", cr80FileFormat)
    Thanks!

  6. #6
    Fanatic Member
    Join Date
    Apr 2002
    Posts
    638
    VB Code:
    1. Report.SaveAs "C:\Documents and Settings\test.rpt", cr80FileFormat

    it was because of the paranthesis

  7. #7

    Thread Starter
    Lively Member claire99's Avatar
    Join Date
    Nov 2002
    Location
    OH
    Posts
    66
    It works! Thanks a lot!!!
    I am new in VB and Crystal Report. I am trying to write a vb program to auto run crystal report daily. I just start learning and testing but have no clear idea yet. Do you know how to do that?

    Claire

  8. #8
    Fanatic Member
    Join Date
    Apr 2002
    Posts
    638
    you could do that with a timer on the form, and set up some code to make it run the report every day. i'm afraid i don't have time to write an example right now, but there's lots of other people here who could help.

  9. #9

    Thread Starter
    Lively Member claire99's Avatar
    Join Date
    Nov 2002
    Location
    OH
    Posts
    66
    Thanks a lot anyway!

    Claire

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