General discussion

Locked

Beginner - Crystal Report and VB - Help needed

By meenasrs ·
Hai,
I am using vb6 and crystal report 8.5. I want to pass a parameter to the crystal report from VB. I used the following code from a book I referred. But it shows syntax error. Pl.guide me.

crystalreport1.selectionformula="{servmst.mrtcd}='"&wmrtcd&"'"

wmrtcd is the variable at run time for the parameter.

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

SYNTAX ERROR

by fbarr_taz In reply to Beginner - Crystal Report ...

IF WMRTCD IS A VARIABLE, THEN YOU DONT NEED TO PUT IT IN QUOTES OR HAVE & CHARACTERS IN FRONT AND BACK OF IT.

IF THE VARIABLE IS A NUMBER THEN USE
"{XXXX.XXXX} = " & WMRTCD

IF IT IS TEXT USE
"{XXXXXX.XXX} = "'" & WMRTCD & "'"

Collapse -

Help in Parameter Passing

by meenasrs In reply to SYNTAX ERROR

The wmrtcd is a string variable. When I tried with the one you post, it shows the following error
Error in formula <Record_selection>
'{servmst.mrtcd}='
A number,currency amount,date,time,date-time,boolean or string is expected here.

When I put a ' mark, it automatically changes like a comment.
Pl. help

Collapse -

To pass something like a single quote

by sjohnson175 In reply to Help in Parameter Passing

you need to use Chr$().

For example Chr$(34) & strVar & Chr$(34) will pass the contents of strVar with a double-quote on each end.

Get it?

Back to Web Development Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums