Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

crystal reports selection formula(vb)

Status
Not open for further replies.

eugesa

Programmer
May 3, 2002
3
ES
I need to know how to make queries with date ranges,using crystal reports selection formula
This is a part of my code:

***************************
If Val(txtdesde) <> 0 Then
consulta = consulta & &quot; and {pasesbancos.fecha}>= '&quot; & txtdesde & &quot;'&quot;
End If
If Val(txthastafech) <> 0 Then
consulta = consulta & &quot; and {pasesbancos.fecha}<= '&quot; & txthastafech & &quot;'&quot;
End If
CrystalReport3.SelectionFormula = consulta
CrystalReport3.Action = 1
***************************

&quot;pasesbanco&quot; is a table's name
&quot;fecha&quot; is a field of this table
&quot;consulta&quot; is a string

thank you
 
The key to getting a selection formula to pass to CR is to make sure you pass a string that is in CR syntax. The easiest way to do that is to look at a working selection formula in the report itself (maybe created by the expert) and duplicate the syntax exactly in your program. Date literals in CR are passed as: Date (2002,5,31)
Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top