|
-
Nov 17th, 2004, 12:54 AM
#1
Thread Starter
Addicted Member
SelectionFormula problem in Crystal
Hi there
I want to pass a parameter from vb6 that whould return like in this example cust 1 and cust 2. How do I do this? Because the selection formula does not seem to work
CR1.ReportFileName = gsReportPath & "\ActiveCust.rpt"
CR1.SelectionFormula = "{Customer.Id} in ('1' ,'2')"
CR1.PrintReport
-
Nov 17th, 2004, 02:09 AM
#2
Is Customer.Id a string? If I remember correctly the Crystal syntax for In is square brackets. Try
CR1.SelectionFormula = "{Customer.Id} in ['1' ,'2']"
-
Nov 17th, 2004, 02:16 AM
#3
Thread Starter
Addicted Member
how would it be handled for a numeric type?
CR1.SelectionFormula = "{Customer.Id} in [1 ,2]"
i have tried this but it doesnt work
-
Nov 17th, 2004, 02:35 AM
#4
Earlier I should have written
The Crystal syntax for In with string parameters is square brackets
CR1.SelectionFormula = "{Customer.Id} in ['1' ,'2']"
The Crystal syntax for In with numeric parameters is the parentheses
CR1.SelectionFormula = "{Customer.Id} in (1 ,2)"
Note - I am going by memory on this one.
-
Nov 17th, 2004, 02:53 AM
#5
Thread Starter
Addicted Member
i cant seem to get the numeric one working so it looks like im left with doing it the long way ie:
CR1.SelectionFormula = "{Cust.Id} = 1 or {Cust.Id} = 2"
-
Nov 29th, 2004, 12:27 PM
#6
PowerPoster
How would you use a VB variable in place of the values 1 or 2?
-
Nov 30th, 2004, 12:43 AM
#7
Thread Starter
Addicted Member
Something like this
Dim str as string
Dim x as integer
for x = 1 to lstCust.ListCount -1
if x = 1 then
str = "{Cust.Id} =" & lstCust.ItemData(X)
else
str = str & "or {Cust.Id} =" & lstCust.ItemData(X)
end if
next x
CR1.SelectionFormula = str
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|