Hi!
Please help me .. urgent
How do i using a Query in crystal report?... I tried using the select expert but I dont know how to go abt it...

from
srao

Dani AI

Generated

A concise practical checklist for using a SQL query with Crystal Reports and automating the Select Expert from VB6 — expands on s suggestion and answers s question for .

First, three reliable ways to base a report on a query:

  • Add a Command in Database Expert and paste your SQL (Crystal will create any Command parameters for you). Good for ad-hoc, complex SQL and when you want the report to run only the rows you need.
  • Use a stored procedure or view on the server. Crystal will pick up the proc and its parameters; this keeps business logic on the DB and generally performs better.
  • Push an ADO recordset into the report at runtime (useful when you need full control over data in code or when combining multiple sources).

Programmatically controlling the Select Expert from VB6:

  • You can set the selection formula string from VB6 rather than fiddling in the designer. For the Crystal ActiveX control the common pattern is:
With CrystalReport1
  .ReportFileName = App.Path & "\MyReport.rpt"
  .SelectionFormula = "{Table.Field} = 'SomeValue'"
  .Action = 1
End With
  • If you use the CRAXDRT (runtime) objects, set the RecordSelectionFormula before reading records:
Dim appCR As New CRAXDRT.Application
Dim rpt As CRAXDRT.Report
Set rpt = appCR.OpenReport("C:\MyReport.rpt")
rpt.RecordSelectionFormula = "{Table.Field} = 'SomeValue'"
rpt.ReadRecords
rpt.PrintOut False

Troubleshooting and tips:

  • Build and test the SQL in the DB first. Use exact field names as shown in the Field Explorer when writing formulas.
  • If a formula has no effect: verify database, refresh/ReadRecords, and ensure logon credentials are applied at runtime.
  • For parameters, let Crystal create report parameters from your Command/stored proc, then set those from VB6 if needed.
  • Avoid SELECT * in Commands; explicit fields reduce mapping problems.

These points extend s high-level advice and directly address s ask about VB6 automation.

Recommended Answers

All 2 Replies

Hi,

U want to design a Report Based on the Result of a Query of Filter out Records for a Condition?

For First Case, Use Stored Procedures For(Oracle/SQL SErver)
Or QueryCommand(Access)

Use "Select Records Expert" for Second Condition.
It will Filter the Records and show, Eg for a period or Particular Customer.


Regards
Veena

is there any way the Select Expert in CR can be programmed in VB 6.0?

commented: You should know by now not hijack threads. -2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.