Results 1 to 5 of 5

Thread: [RESOLVED] Crystal Report Printing

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2005
    Posts
    154

    Resolved [RESOLVED] Crystal Report Printing

    I had develop a program using VB6 with Crystal Report 8.5 as reporting tools. When I run this piece of code on end-user's platform, I will get error when printing the report. The message appears to be 'Cannot open SQL Server'. But when I open the report designer, and I go to 'Database->Verify Database', then it works, it requires the connection to ODBC. Is there a way to by pass this step? Avoid the pop up error message?

    Pls advise.

    Thanks.

  2. #2
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    Re: Crystal Report Printing

    I use this bit of code to run reports. It does the db stuff..
    VB Code:
    1. Set Report = crxApplication.OpenReport("Z:\DAD\LotJobDiff.rpt", 1)
    2. For Each crxDatabaseTable In Report.Database.Tables
    3.     crxDatabaseTable.ConnectionProperties("user id") = "sa"
    4.     crxDatabaseTable.ConnectionProperties("Password") = myPasswordTechniSQL
    5. Next crxDatabaseTable
    6. Report.SelectPrinter glbPrinterDriver, glbPrinterName, glbPrinterPort
    7. Report.PaperOrientation = crDefaultPaperOrientation
    8. If glbPrinterDestination = 0 Then
    9.     glbReportForm = "frmPSOutOfSynch"
    10.     CRViewer.Show vbModal
    11. Else
    12.     Report.PrintOut False
    13. End If
    Last edited by Hack; Jul 28th, 2005 at 09:01 AM.

  3. #3
    New Member
    Join Date
    Jul 2005
    Posts
    7

    Re: Crystal Report Printing

    Hi,
    I guess whatever connection string you are using in your data entry forms just use that connection string for your crystal reports connection. I guess it should work.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Jul 2005
    Posts
    154

    Re: Crystal Report Printing

    Hi Pasvorto

    Could you pls post the full code for the process??
    I dont quite get your ideas...

    Thanks

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

    Re: Crystal Report Printing

    You may also need .SetLogonInfo, but I have a couple of examples in my signature for CR.
    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