• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1049
  • Last Modified:

crystal report 4.6 - apostrophe in formula

how do I handle apostrophes in formula to be passed to a report without causing an error. I tried replace ' with '' but still wont work.
0
tsluu
Asked:
tsluu
  • 3
  • 2
1 Solution
 
mlmccCommented:
What are you trying to do?

Crystal formulas can use " " or ' ' for string data.  I would think you could use " " for the strings and a ' would then simply be a character.

mlmcc
0
 
tsluuAuthor Commented:
crpt.Formulas(0) = "ReportTitle='MacDonald's Burger'"
the above will give an error.

So I tried
crpt.Formulas(0) = "ReportTitle='MacDonald''s Burger'"
and still give an error.

How do I solve the apostrophe problem?


0
 
mlmccCommented:
Try
crpt.Formulas(0) = "ReportTitle='MacDonald""s Burger'"

That is a double double quote in Mconald's

mlmcc
0
 
tsluuAuthor Commented:
crpt.Formulas(0) = "ReportTitle='MacDonald""s Burger'" works fine but my report title will display:

MacDonald"s Burger

instead of :

MacDonald's Burger
0
 
mlmccCommented:
Try

crpt.Formulas(0) = "ReportTitle='MacDonald' + chr(27) + "'s Burger'"

chr(27) is the '

mlmcc

0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now