Solved

Passing Selection and Sorting Criteria To Crystal Reports

Posted on 1998-06-28
4
464 Views
Last Modified: 2008-02-01
I'm using VB4. I need to create a form for the user to select criteria to display on a crystal report. HOW do I do it?
I have an Access 2.0 database for employee info. I want to create a form to select The range of locations and then either sort by location or name or SS#. Then print a crystal report.
0
Comment
Question by:DPPro
  • 2
  • 2
4 Comments
 
LVL 3

Expert Comment

by:AndreasSchindler
ID: 1464465
You Can Set the SelectionFormula Property of th Report Control.
For Example:
rep1.Selectionformula="{Table.Col}>" & Edit1 & " and {Table.Col}<" & Edit1
rep1.action=true
0
 

Author Comment

by:DPPro
ID: 1464466
This was a good start but I need more info.. Also don't forget the user selected sort order
0
 
LVL 3

Accepted Solution

by:
AndreasSchindler earned 100 total points
ID: 1464467
Description

Specifies the field(s) that are to be used to sort your data when the report is printed.

Usage

[form.]Report.SortFields(ArrayIndex)[= "{+|}SortField"]

Enter the fields on which you want the data in your report to be sorted.

For example:

To sort an order database alphabetically by customer, and then by order date, you can enter code similar to the following:

CrystalReport1.SortFields(0) = "+{orders.CUSTOMER}"
CrystalReport1.SortFields(1) = "+{orders.ORDERDATE}"

Remarks

  SortFields is an array property available only at runtime.

  Use a separate line of code to specify each sort field.

  Enter sort fields in the order that you want them to sort your report. For example, if you want your report to be sorted first on field A and then on field B, specify sort field A in your first line of code and sort field B in your second line of code.

  The sort field you specify must be assigned array index 0, the second sort field must be assigned array index 1, etc.

  The index values you assign must be continuous; no gaps are allowed (0,1,2 = OK, 0,1,3 = wrong)

  Array index values must be subscripted in the code immediately after the property name (i.e., CrystalReport1.SortFields(0) =).

  If you have specified sort fields for your report at Design Time, any sort fields you enter here will replace the sort fields in your report.

  If you do not use this property, the program will use the sorting instructions that you specified in the report.

  If you want to clear the sort fields in your report, use an empty string (CrystalReport1.SortFields(0) = "").

  Enclose field names in braces.

  Sort fields can be database fields or formula fields. If you sort on a formula field, use the @ sign before the formula name (i.e., @FORMULANAME).

Data Type

Array of strings

Availability

Runtime

0
 

Author Comment

by:DPPro
ID: 1464468
It worked...Here is your points
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
vb6 programatically bring window to front 8 65
add text to end of existing text in file 16 69
VBA error replacing data 6 37
using Access 8 59
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

863 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now