English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

strReport = "{Country.city} = " & ddl_city.SelectedValue() & ""
When I try to run it it keeps giving me the following error:
Error in formula . '{Country.city} = New York' A number, currency amount, boolean, date, time, date-time, or string is expected here.
I've been searching everywhere and modifying the statement but it still doesn't work. Please help!!! =(
Thanks...

2007-01-22 12:40:41 · 2 answers · asked by Anonymous in Computers & Internet Programming & Design

2 answers

You have an error when assigning the value it should be this Way

strReport = "{Country.city} = '" & ddl_city.SelectedValue() & "'"

add a simple quote ( ' ) after the equal sign and a single quote inside the final double quotes.

that should do it.

the Error is because Crystal is trying to receive a valida data type but instead is receiving the value that returns ddl_city.SelectedValue() as a variable or something

Regards.

2007-01-23 15:24:57 · answer #1 · answered by Kool_Joss 2 · 0 1

Hi.

You didn't indicate your programming environment but I think you are trying to develop a VB application that generates a Crystal Report. I also believe that you are populating a string variable named strReport and then are using that variable to set the Record Selection criteria of your report. I also believe that you are getting this error when your try to run the report.

Please correct me if I am wrong (or if you are developing a Crystal Report directly through a Crystal Reports desktop program such as Crystal Reports XI Professional).

The previous answer that was given is correct. When generating your record selection criteria it should look something like:
{Country.city} = 'Paris'

You are creating your record selection criteria dynamically within a string and the result of your code creates a statement like:
{Country.city} = Paris

The value Paris needs to be a literal string and that's why you need the single quote in front of and in back of the ddl_city.SelectedValue(). You are getting the error because you did not use the quotes.

So be sure to add the single quotes so that your code looks like:
strReport = "{Country.city} = '" & ddl_city.SelectedValue() & "'"

I realize it is hard to read exactly what I have typed for my answer so I recommend that you copy and paste my suggested answer into Notepad where you can view it using a Courier New font. The solution will be very apparent.

Jeff

2007-01-26 15:22:02 · answer #2 · answered by Jeff B 5 · 1 0

fedest.com, questions and answers