|
-
Dec 18th, 2004, 03:52 AM
#1
Thread Starter
Addicted Member
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?
-
Dec 18th, 2004, 04:00 PM
#2
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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 
-
Dec 19th, 2004, 03:39 AM
#3
Thread Starter
Addicted Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|