Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SelectionFormula problem

Status
Not open for further replies.

jewels1

Technical User
May 29, 2003
3
0
0
US
I have a CR with an SQL statement with an existing where clause. I also want to populate a SelectionFormula to add further criteria from my VB program.

When I put the criteria directly into CR this works, yet when I copy it to VB it gives me an error :

&quot;Error in formula <Record_Selection>
'
'
The remaining text does not appear to be part of the formula.

The VB statement looks like this :
rpt1.SelectionFormula = &quot; {client.client_id} = 1 AND {client.address_id} = 1&quot;


Any ideas, please ?
 
I don't use VB myself, but this often helps in other languages.

rpt1.SelectionFormula = &quot; ({client.client_id} = 1) AND ({client.address_id} = 1)&quot;

Notice the extra brackets. This should clarify the evaluation order of the expression.
 
Unless the id & address in the above sample is numeric data, they must have single quotes around them if they are to be contained within another string which is enclosed in double quotes. ie:
rpt1.SelectionFormula = &quot; {client.client_id} = '1' AND {client.address_id} = '1'&quot;

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top