Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB Databases
|
Pro VB Databases Advanced-level VB coding questions specific to using VB with databases. Beginning-level questions or issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 18th, 2004, 01:39 AM
Authorized User
 
Join Date: Jun 2003
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default Changing Crystal Report Title from VB Code

I have been trying to browse a Crystal Report with following VB code:

 CrystalReport1.ReportFileName = "C:\Report1.rpt"
 CrystalReport1.ReportTitle = "Title of the Report"
 CrystalReport1.Action = 1

I do not see any change in the title. How can I pass a title from VB to my report?
 
Old May 18th, 2004, 02:35 AM
Authorized User
 
Join Date: Jun 2003
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The way I do this is
1) In you crystal report create a parameter field, here it is called "username"
2) Then in you code use this

crxReport.ParameterFields.GetItemByName("username" ).AddCurrentValue "Printed by: IOates"
crxReport.EnableParameterPrompting = False
crxReport.Database.SetDataSource gRst, 3, 1

With CRViewer
 .Visible = True
 .ReportSource = crxReport
 .ViewReport
End With

Hope this helps
Ian

 
Old May 19th, 2004, 02:47 AM
Authorized User
 
Join Date: Jun 2003
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Ian
I tried to use your code by opening my Crystal Report file with CrxApplication.OpenReport method. I am getting the error message "Server has not yet opened" while executing CRViewer1.ViewReport

My backend is a Oracle Server. I don't know how to send the password by code.

If you have any suggestions, please let me know.

Regards

Niaz
 
Old May 24th, 2004, 02:49 AM
Authorized User
 
Join Date: Jun 2003
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi (sorry for late reply)
First you need to setup your connection string to Oracle (try this link http://www.connectionstrings.com for examples).

My variable gRst in the example is the returned recordset that contains the data, before you even touch CR make sure that your recordset contains data (eg. msgbox gRst.RecordCount),

hope this helps
Ian

 
Old June 9th, 2004, 09:51 PM
Authorized User
 
Join Date: May 2004
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to myedu2k4
Default

Hi there,

I am very interested in the website that ioates told.
Anyway could any one tell me how many way that we can connect from VB to Crystal Report. As i know there are two ways, but i don't know the exact code for that. Hope to get some help....

Pheap






Similar Threads
Thread Thread Starter Forum Replies Last Post
CRYSTAL REPORT 9 Changing Connection Properties aquiintac VB Components 0 November 6th, 2007 05:17 AM
VB code to title chart sheets individually Christen Beginning VB 6 1 October 18th, 2006 09:16 PM
Changing Database location for crystal report swarnapy VB How-To 0 August 27th, 2006 11:37 PM
Crystal Report Changing Orientation garrysmith68 Beginning VB 6 0 June 6th, 2006 06:42 AM
Changing Crystal report display dynamically Sujith Manuel Crystal Reports 0 December 17th, 2004 01:59 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.