Results 1 to 3 of 3

Thread: Crystal Report

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2004
    Posts
    69

    Crystal Report

    Dear Friends,
    I am Using Crystal report 9.0 Enterprice Edition.
    I want a vbcode to print report directly without preview the report. and also need the code to select the printer If the system is connected more than one printer.

    Thank a lot.
    Attached Files Attached Files

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,710
    To bring up CR's Print Setup dialog box...
    VB Code:
    1. 'Bring up CR Printer Setup dialog
    2. Report.PrinterSetup lHwnd
    3. gsOrientation = Report.PaperOrientation 'Save orientation into var
    4. Printer.Orientation = Report.PaperOrientation
    5. Report.SelectPrinter Report.DriverName, Report.PrinterName, Report.PortName
    6. gsPrinterName = Report.PrinterName 'Save other settings to vars
    7. gsPrinterDriver = Report.DriverName '...
    8. gsPortName = Report.PortName '...
    9. '...
    10. 'Set the report source (if using already opened ADO recordset).
    11. 'Report.Database.SetDataSource oRs, 3, 1
    12. '...
    13. 'Then you can set the report to whatever the user selected and print out.
    14. Report.DisplayProgressDialog = True
    15. Report.SelectPrinter gsPrinterDriver, gsPrinterName, gsPortName
    16. Report.PaperOrientation = gsOrientation
    17. Report.PrintOut True, 1
    HTH
    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
    New Member
    Join Date
    May 2006
    Posts
    1

    Re: Crystal Report

    hello, sorry to bring this thread back up. It's just that I have a very similar problem but I can't figure out how to use the previous solution in my code.

    My programme consists of a database with a table of registered user data and a table of the donations these registered people have done.

    when the programme first starts up you see a switchboard which can send you to a form to edit the user data, donations, etc. ; or it can send you to some reports of the user data. I have made the first report, and I can view it in the crystal report viewer.. No problems there. (I can even press the print button of the crystal report viewer and it works)
    The problem is now that I have a printbutton next to the button to open the crystal report viewer (CRV). So what I would need is a way to print the report without having to open it first and then manually click the print button on the CRV.
    Attached Images Attached Images  

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