Print Page | Close Window

How can I insert a where clause This code please

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2022
Forum Name: Data Connectivity
Forum Discription: How to connect to data sources and export reports
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=18342
Printed Date: 20 Apr 2025 at 11:55am


Topic: How can I insert a where clause This code please
Posted By: marztar
Subject: How can I insert a where clause This code please
Date Posted: 29 Dec 2012 at 5:23am
Hi :)

How are you all ? Well, I'm new ere as I was facing a problem that could be an easy one to so many of you . I am working with VB6 and designing my reports using Crystal report 4.6 . I have set my sql statement ready to search between 2 dates . now I want to add another criteria to the same statement which is I have a field called "Carrier" in the same table "Exp" so the records that i want to show in the report are the ones that have a carrier which is given in a textbox but still its between the 2 dates . this is my code .


'''''''''''''''''''''''''''''''''''''''''''''''
On Error Resume Next
Dim j
Dim counterx
Dim i As Integer
j = GetSetting("Shipping", "1", "Path")
For i = 1 To Len(j)
counterx = Mid(Right(j, i), 1, 1)
If counterx = "\" Then
counterx = Mid(j, 1, Len(j) - i) & "\expetd.rpt"
CrystalReport1.ReportFileName = counterx
CrystalReport1.SelectionFormula = "{Exp.ETD} In Date(" & Format(Text1.Text, "yyyy,mm,dd") & ") To Date(" & Format(Text2.Text, "yyyy,mm,dd") & ")"
CrystalReport1.Action = 1
Exit Sub
End If
Next
'''''''''''''''''''''''''''''''''''''''''''''''



Replies:
Posted By: marztar
Date Posted: 31 Dec 2012 at 11:44pm
Someone help me please :/


Posted By: hilfy
Date Posted: 04 Jan 2013 at 7:47am
You'll change your selection formula.  It will look something like this:
 
CrystalReport1.SelectionFormula = "{Exp.ETD} In Date(" & Format(Text1.Text, "yyyy,mm,dd") & ") To Date(" & Format(Text2.Text, "yyyy,mm,dd") & "{MyTable.Carrier} = " & Text3.Text & ")"
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics



Print Page | Close Window