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 > VB Components
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB Components Issues specific to components in VB.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Components 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 July 7th, 2004, 03:28 AM
Registered User
Join Date: Jul 2004
Location: Dubai, , United Arab Emirates.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Urgent PLZ,Crystal Report With VB6 problem

PLZ help me,I form the a table in the SQL Server DB at run time, and I need to report it,so I have to use SetDataSource procedure from CRAXDRT.report.Database object, now how can I show the data at run time in deails section, cuz no data shown, plz help me
this is my code:
   Set rs = New ADODB.Recordset
    rs.Open "SELECT ...", conn, adOpenStatic,adLockReadOnly 'Suppose the SQL is true

    Set crystal = New CRAXDRT.Application 'MANAGES REPORTS

    Set report = crystal.OpenReport(App.Path & "\report2.rpt") 'OPEN OUR REPORT

    report.Database.SetDataSource rs 'LINK REPORT TO RECORDSET

    CRViewer.ReportSource = report 'LINK VIEWER TO REPORT
    CRViewer.EnableExportButton = True

    CRViewer.ViewReport 'SHOW REPORT


Reply With Quote
  #2 (permalink)  
Old July 9th, 2004, 12:10 AM
Registered User
Join Date: Jan 2004
Location: Bangalore, Karnataka, India.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts

Wrox answer

Hai there

Good to see your question is in detail.
i will try to help it may or maynot work.

Cr.Query = "select * form emp where x='1a' y="1

now show the report it will automatically come
no need to set the datasource.

i think the datasource is a conneciton like and not the data itself.


Reply With Quote
  #3 (permalink)  
Old July 18th, 2004, 10:54 AM
Registered User
Join Date: Jul 2004
Location: Dubai, , United Arab Emirates.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts

I find a solution, and I would like to tell you.
When u want to report any table, and this table is created and formed at run time,you can create Crystal report file at run time, and also design it by an API that Crystal Reports support,this API Called CRD(Crystal Run time design),
and I'm ready to give a full example about it.

Reply With Quote
  #4 (permalink)  
Old September 16th, 2004, 05:17 AM
Registered User
Join Date: Sep 2004
Location: Lagos, Lagos, Nigeria.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

I saw your problem and how u solved it.
I have a similar problem. I am trying to make my users select the fields they want to report at run time.. that is create a report at run time depending on the fields the user want from my visual basic (6.0) program. The user will also select the width of the fields. The error message i keep getting is that "Creation feature no enabled" I tried the sample code in cystal 9.0 and the message is the same. How can I achieve this. I will like you to give me the codes to do this.
Thanks in anticipation.

Reply With Quote
  #5 (permalink)  
Old November 12th, 2004, 05:48 AM
Registered User
Join Date: Nov 2004
Location: Cavite, , Philippines.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

  I have encountered the same problem too, does anyone replied on your problem or do you resolve the problem. Ive tried different approach yet I still need the pattern of creating an ADOcommand to lessen my code. Thanks in advance.

Reply With Quote
  #6 (permalink)  
Old December 31st, 2006, 03:28 AM
Registered User
Join Date: Dec 2006
Location: Tehran, , Iran.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

I've had this problem too. I find a way for solving this problem and I use it in my program. When you want to use SetDataSource method you should also provide datatag parameter too. I dont know what the datatag parameter is but when I set it to 3 it will work. So you should type this code:

Dim ac As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim Report As New [CrystalReportDesigner]

call ac.open(["connection string"])
call rs.open(["SQL Query"],ac)
call Report.SetDataSource(rs,3)

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
one from tag problem, plz help, urgent! many thxxx raybristol ASP.NET 1.0 and 1.1 Basics 0 December 29th, 2005 08:24 PM
Crystal Report 4.6 in vb6 alaa_h78 Beginning VB 6 2 November 22nd, 2005 09:31 PM
Crystal Reports and VB6 - URGENT! sterankin VB How-To 1 September 23rd, 2005 07:27 AM
crystal report and vb6 zaeem VB Databases Basics 0 May 20th, 2005 11:59 AM
Crystal report 9 on VB6 mahanama VB How-To 2 February 1st, 2005 09:11 AM

All times are GMT -4. The time now is 11:11 PM.

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