Results 1 to 4 of 4

Thread: User-defined type not defined & Crystal RPT

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2000
    Posts
    303
    Hi all,

    I posted a question about how to use Crystal Report, and I
    got a sample from DavidRobin, but I could not figure it out.

    I paste the code he provided, but it would not compile. The
    compiler is complaining that the User-defined type not defined and the lines it does not like are the two
    dims below:

    Dim Appl As CRAXDRT.Application
    Dim Report As New CRAXDRT.Report

    What Project->References or Project->Components must I
    attach?

    Here is the sample code David provided:


    ' holds the report file path
    Private mRepFile As String

    Private Sub Form_Load()
    Set Appl = New CRAXDRT.Application
    Set Report = Appl.OpenReport(mRepFile)
    Report.DiscardSavedData
    Report.Database.Tables(1).SetLogOnInfo <database>, , <UserID>, <password>

    CRViewer1.ReportSource = Report
    CRViewer1.ViewReport

    CRViewer1.Top = 0
    CRViewer1.Left = 0
    End Sub

    Private Sub Form_Resize()
    ' keeps the CRViewer the same size as the form
    CRViewer1.Width = Me.ScaleWidth
    CRViewer1.Height = Me.ScaleHeight
    End Sub

    ' Property to allow the report path to be passed in
    Property Let ReportFile(rep As String)
    mRepFile = rep
    End Property

    Private Sub Form_Unload(Cancel As Integer)
    Set Appl = Nothing
    Set Report = Nothing
    End Sub
    Private Sub mnuOutstanding_Click()
    frmReportView.ReportFile = App.Path & "\Students.rpt"
    frmReportView.Caption = "Crystal Report Viewer [Students.rpt]"
    frmReportView.Show vbModal
    frmReportView.ReportFile = ""
    Set frmReportView = Nothing
    End Sub


  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    The answer is probably contained in davidRobin's original answer when he said
    Ensure the references are set in the Project menu for any project that uses this form:

    Cristal Report Viewer Control
    Cristal Report 8 ActiveX Designer Run Time Library


    (the 8 is version 8 that we use, you may have a different version)

    Create a new form and place the CRViewer control on it and paste the following code on the form:
    I assume he meant "Crystal" and not "Cristal" but in either case I don't find either of them in my Project>References, so I further assume that he installed a stand-alone version of Crystal reports.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2000
    Posts
    303

    Is Crystal Report not a part of MSVB?

    Yes, I tried to find what DavidRobin suggested, but could
    not find such thing or anything that is close to that.

    This is kind a dump, but where can I find more information
    about Crystal Report? Is it part of MS VB or do I have
    to purchase it separately, and if it separate where can
    find it?

    Thanks for the help.

  4. #4

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