Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB Databases
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old May 18th, 2004, 01:39 AM
Authorized User
 
Join Date: Jun 2003
Location: Dhahran, Eastern Province, Saudi Arabia.
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?
Reply With Quote
  #2 (permalink)  
Old May 18th, 2004, 02:35 AM
Authorized User
 
Join Date: Jun 2003
Location: Manchester, , United Kingdom.
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

Reply With Quote
  #3 (permalink)  
Old May 19th, 2004, 02:47 AM
Authorized User
 
Join Date: Jun 2003
Location: Dhahran, Eastern Province, Saudi Arabia.
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
Reply With Quote
  #4 (permalink)  
Old May 24th, 2004, 02:49 AM
Authorized User
 
Join Date: Jun 2003
Location: Manchester, , United Kingdom.
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

Reply With Quote
  #5 (permalink)  
Old June 9th, 2004, 09:51 PM
Authorized User
 
Join Date: May 2004
Location: Phnom Penh, , Cambodia.
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

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
CRYSTAL REPORT 9 Changing Connection Properties aquiintac VB Components 0 November 6th, 2007 04: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 12:59 AM



All times are GMT -4. The time now is 02:15 AM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.