Crystal Report & VB with single quote
Try this:
Dim myStr as string
Dim sQte As String
myStr = "It's a test"
sQte = Chr$(34)
'The error is on this line ...
form1.CrystalReport1.formulas(0) = "Title=" & sQte & myStr & sQte
form1.CrystalReport1.Destination = crptToWindow
form1.CrystalReport1.WindowState = crptMaximized
form1.CrystalReport1.Action = 1
form1.CrystalReport1.Reset
Quote:
> Hi, I have a problem with vb and crystal report. It's when i try to
> pass on parameter a string containing a single quote to crystal report
> (on a formulas) from vb.
> This is a example :
> --------------------------------------------------------------------------
-----------
> Dim myStr as string
> myStr = "It's a test"
> 'The error is on this line ...
> form1.CrystalReport1.formulas(0) = "Title='" & myStr & "'"
> form1.CrystalReport1.Destination = crptToWindow
> form1.CrystalReport1.WindowState = crptMaximized
> form1.CrystalReport1.Action = 1
> form1.CrystalReport1.Reset
> --------------------------------------------------------------------------
-----------