Crystal Report & VB with single quote 
Author Message
 Crystal Report & VB with single 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

-------------------------------------------------------------------------------------



Sat, 24 May 2003 09:18:55 GMT  
 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

> --------------------------------------------------------------------------

-----------


Sat, 24 May 2003 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Can not pass single quote string to crystal report

2. Escape single quote in crystal report?

3. Single Quotes converted to double Single Quotes

4. Problem with crystal, VB and single quote

5. DBCombo & single quote

6. Single & Double Quotes

7. Single quotes and double quotes

8. Double Quotes, Then Single Quotes, what comes next?

9. Double Quotes, Then Single Quotes, what comes next?

10. Double Quotes, Then Single Quotes, what comes next?

11. Double Quotes, Then Single Quotes, what comes next?

12. Double Quotes, Then Single Quotes, what comes next?

 

 
Powered by phpBB® Forum Software