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 6
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 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
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 4th, 2006, 03:28 AM
Registered User
Join Date: Nov 2006
Location: Hyderabad, Andhra Pradesh, India.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Change datasource of crystal report at runtime

Hi all,

This is Padma
I have a problem regarding crystal reports.

I have added a crystal report designer into my project.I have used MSaccess as the database and when I have added crystal report as a designer,code has been automatically added with CRViewer9 control to view the report.

Now my problem is that i have to change the datasource of the report at runtime

Code is like this

Dim Report as CrystalReport1


I have tried adding a line of code to change the database

Report.Database.SetDataSource(App.Path & "\DB.mdb")

but not working

If anybody can help me i would be thankful

Reply With Quote
  #2 (permalink)  
Old March 21st, 2008, 05:45 AM
Registered User
Join Date: Mar 2008
Location: Eorde, TN, India.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts

  try this. this may help you.

Dim appl As New CRAXDRT.Application
Dim rep As New CRAXDRT.Report
Dim cpars As CRAXDRT.ParameterFieldDefinitions
Dim cpar As CRAXDRT.ParameterFieldDefinition

rep.Database.Tables(1).Location = App.Path & "\DataBase.mdb"

CRViewer91.ReportSource = rep

rep.EnableParameterPrompting = False
'If you use any parameter
rep.ParameterFields(1).AddCurrentValue "Instring"

rep.Database.SetDataSource rs

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Enable crystal report datasource dialogbox owen_xgy .NET Framework 2.0 2 November 21st, 2008 07:44 AM
change Datasource of a crystal report at run time tiyyob Pro VB 6 1 February 17th, 2007 06:05 AM
Creating a Crystal Report from a runtime dataset vbmazza ASP.NET 1.0 and 1.1 Basics 0 March 17th, 2006 07:40 AM
Sorting at runtime in Crystal report vidya ASP.NET 1.x and 2.0 Application Design 1 March 15th, 2005 01:57 AM
passing parameters at runtime using crystal report anilkumar Crystal Reports 2 January 3rd, 2004 01:35 AM

All times are GMT -4. The time now is 06:26 AM.

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