Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Crystal Reports Sending SQL statement to report

Posted on 2000-03-13
2
200 Views
Last Modified: 2010-05-02
How do i create a report that I would be able to send a sql statement created by my program, and what is the syntax to do so.

Any code or examples would be great!

Thanks,
Geo90
0
Comment
Question by:geo90
2 Comments
 

Expert Comment

by:soosairaj
ID: 2615036
Dear friend..  
use like this. first create a general report.. while calling from Vb. pass like this arguments


occtype = "IN"
    str = "{Incidents_Monthly.Month}=" & MONTHVAL & "And {Incidents_Monthly.Year}=" & YEARVAL & "and {Incidents_Monthly.occurrence_type}='" & occtype & "'"

 CrystalReport2.SelectionFormula = str
 CrystalReport2.Formulas(0) = "MONTHNAME='" & Me!Month & "'"
    CrystalReport2.Formulas(1) = "yearvalue=" & Me!Year
   CrystalReport2.Destination = 0
    CrystalReport2.Action = 1




And also

CrystalReport2.ReportSource
 CrystalReport2.datasource

you can use..

Raj
 

0
 

Accepted Solution

by:
AshokKumar earned 50 total points
ID: 2615156
u have all the property essential to send parameters, formulae and even SQL query from VB to the Crystal Report. You have a property CrystalReport1.SqlQuery. Use this to pass Sql  query to your report. Remember all the fields from the query should match the report fields. This would work absolutely fine.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question