Results 1 to 3 of 3

Thread: Directly printing Crystal Report.

  1. #1

    Thread Starter
    Addicted Member rpk_20061975's Avatar
    Join Date
    Jun 2001
    Location
    India
    Posts
    234

    Unhappy Directly printing Crystal Report.

    I have Database Fields on my Crystal Report and want to directly print the .RPT file from Visual Basic 6, without importing the report, as a Form, in VB.

    How to directly print the .RPT file and populate its Database Fields with records in a recordset?

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

    Re: Directly printing Crystal Report.

    Code:
    'ADO objects are populated and open.
    Set crxApp = New CRAXDRT.Application
    Set moReport = New CRAXDRT.Report
    
    Set moReport = crxApp.OpenReport(App.Path & "\MyReport.rpt", 1)
    moReport.Database.SetDataSource goRs, 3, 1
    moReport.DisplayProgressDialog = True
    moReport.PrintOut True, 1
    Then depending on your database, this will be for SQL server after the OpenReport method.
    Code:
    moReport.Application.LogOnServer "P2SSQL.DLL", sServer, sDatabase, sUserName, sUserPwd
    moReport.Database.Tables(1).SetLogOnInfo sServer, sDatabase, sUserName, sUserPwd
    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

  3. #3

    Thread Starter
    Addicted Member rpk_20061975's Avatar
    Join Date
    Jun 2001
    Location
    India
    Posts
    234

    Unhappy Re: Directly printing Crystal Report.

    Thanks RobDogg for the code. I have some more queries:

    I am using Access XP MDB and its connection string looks like this:

    Code:
    "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=false;
    Data Source=" & App.Path & "\Data\cust.mdb;Jet OLEDB:Database Password='ProgramKey';
    User ID='Admin'"
    I have some more problem with password-protected MDB files. Kindly view
    my this post too:

    http://www.utteraccess.com/forums/sh...b=5&o=&fpart=1

    Also illustrate how to pass the password to call Crystal Report.

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