Results 1 to 6 of 6

Thread: Recordsets and Crystal Reports

  1. #1

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    is clientnum an identity field?

  2. #2
    New Member WirelessToronto's Avatar
    Join Date
    Mar 2002
    Location
    Canada
    Posts
    9
    Originally posted by kleinma
    is clientnum an identity field?
    Yes it is...it is the primary key.

  3. #3

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    im sorry i forgot to ask.. what version of CR are you using?

  4. #4
    New Member WirelessToronto's Avatar
    Join Date
    Mar 2002
    Location
    Canada
    Posts
    9
    Originally posted by kleinma
    im sorry i forgot to ask.. what version of CR are you using?
    Crystal Reports 8.5 and Visual Basic 6 Pro
    WirelessToronto
    [email protected]

  5. #5

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    well i know you can pass parameters into crystal.. but i have no books in crystal and their site is pretty sucky... I do something similar to what you want to do.. and this is how I did it...

    what you would do (1 way at least) is design the report in crystal and then save it to a drive (rpt file)

    I just posted this for someone else on here actually.. but I will add a part to it for u
    VB Code:
    1. Public Sub RunReport(ClientNum as string)
    2.  
    3.     On Error GoTo EH:
    4.    
    5.     Dim CApp As New CRAXDRT.Application
    6.     Dim CReport As CRAXDRT.Report
    7.     Screen.MousePointer = vbHourglass
    8.    
    9.     '  Use the .OpenReport method of the Application object to set your Report object to a RPT file
    10.     Set CReport = CApp.OpenReport("C:\MyReport.rpt")
    11.    
    12.     '  Use the DiscardSavedData method to ensure that your report hits the Database and refreshes the data
    13.     CReport.DiscardSavedData
    14.    
    15.     CReport.RecordSelectionFormula = "{table.field} = " & ClientNum
    16.  
    17.     crView.ReportSource = CReport
    18.    
    19.     CReport.Database.Tables(1).SetLogOnInfo "SERVER", "DBNAME", "LOGON", "PASSWORD"
    20.    
    21.     crView.ViewReport
    22.    
    23.     ' Zoom the preview window
    24.     crView.Zoom 75
    25.    
    26.     Screen.MousePointer = vbDefault
    27.    
    28.     Exit Sub
    29.  
    30. EH:
    31.     MsgBox Err.Description
    32. End Sub

    where crView is the viewer control...
    add a reference to the crystal runtime too...
    Last edited by kleinma; Apr 19th, 2002 at 11:12 AM.

  6. #6

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