Results 1 to 2 of 2

Thread: Crystal Migration

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2005
    Location
    Boston, MA
    Posts
    5

    Crystal Migration

    I need to upgrade some reports for the VS VB6 built in Crystal 4.0 to Crystal 9.0… I am using DAO recordsets and cannot get Crystal to load only specific data, it loads the entirety of the database. My code is below

    all variables have been declared properly.

    VB Code:
    1. Set db = Workspaces(0).OpenDatabase(szDatabaseName, False, True)
    2.    
    3.     Set rs = db.OpenRecordset( _
    4.             "select [HCPCS].[Code] " & _
    5.               "from [HCPCS] " & _
    6.                 "where [HCPCS].[Code] >= '" & szStartHCPCS & "' " & _
    7.                     "and [HCPCS].[Code] <= '" & szEndHCPCS & "' " & _
    8.                     "and [HCPCS].[Year] = " & szYear & " " & _
    9.                 "order by [HCPCS].[Code]", _
    10.             dbOpenSnapshot)
    11.                      
    12. If rs.BOF Or rs.EOF Then
    13.     MsgBox "CPT/HCPCS code range: " & szStartHCPCS & " thru " & szEndHCPCS & " produces no matches.", 64, "No Match Found"
    14. Else
    15.     frmHCPCSReport.Hide
    16.     DoEvents
    17.     Set rptStand = app1.OpenReport(App.Path + "\standard.rpt")
    18.     rptStand.DiscardSavedData
    19.     rptStand.Database.SetDataSource rs
    20.     rptStandard.Show

    When this loads it gives me everything not what is selected. Any ideas? Excuse my ignorance on this, I am new to the new Crystal reports.

    Thanks in advance.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Crystal Migration

    Welcome to the Forums.

    Make sure you recordset is returning the correct data first. Also add the
    correct parameters to the ReportSource property as i show below.

    VB Code:
    1. rptStand.Database.SetDataSource rs, 3, 1
    I cant remember but dont you need a boolean (True/False) after .DiscardSavedData?
    VB Code:
    1. rptStand.DiscardSavedData = True
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

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