Monday, February 20, 2012

Record selection Formula

Hi all

my report is having a selection formula like this

BooleanVar CRef;
CRef :=({@.Is_CrossRef}=False) and ({AccVchHead.VchType}='Inv' or {AccVchHead.VchType}='Purch');
{AccVchHead.Vch_ID} > 0 AND
(CRef and {AccVchDet_1.Party_ID}={AccVchDet.Party_ID} Or
(Not CRef And {AccVchDet_1.Party_ID}<>{AccVchDet.Party_ID} And
(({AccVchDet_1.Amount}>0 and {AccVchDet.Amount}<0) or ({AccVchDet_1.Amount}<0 and {AccVchDet.Amount}>0))))

And i need to pass selection formula value from vb also

crystalreport.selectionformula=strsel (one selection formula)
crystalreport.action=1

This procedure gives error message saying BooleanVar Cref; Fieldname not found

Expecting positive replies

TonyBooleanVar CRef;
CRef :=({@.Is_CrossRef}=False) and ({AccVchHead.VchType}='Inv' or {AccVchHead.VchType}='Purch');
{AccVchHead.Vch_ID} > 0 AND
(CRef and {AccVchDet_1.Party_ID}={AccVchDet.Party_ID} Or
(Not CRef And {AccVchDet_1.Party_ID}<>{AccVchDet.Party_ID} And
(({AccVchDet_1.Amount}>0 and {AccVchDet.Amount}<0) or ({AccVchDet_1.Amount}<0 and {AccVchDet.Amount}>0))))
I assume this is the formula that is in the Crystal Reports formula and not the one from VB, correct?

crystalreport.selectionformula=strsel (one selection formula)
crystalreport.action=1

What is this --> strsel (one selection formula) ?

Try this:

crystalreport.selectionformula = "BooleanVar CRef; " & vbCrLf _
& "CRef :=({@.Is_CrossRef}=False) " _
& "and ({AccVchHead.VchType}='Inv' " _
& "or {AccVchHead.VchType}='Purch'); " & vbCrLf _
& "{AccVchHead.Vch_ID} > 0 " _
& "AND (CRef and {AccVchDet_1.Party_ID}={AccVchDet.Party_ID} " _
& "Or (Not CRef And {AccVchDet_1.Party_ID}<>{AccVchDet.Party_ID} " _
& "And (({AccVchDet_1.Amount}>0 and {AccVchDet.Amount}<0) " _
& "or ({AccVchDet_1.Amount}<0 and {AccVchDet.Amount}>0)))) "|||Hi Malll

Thanx for replying my query is as u specified it is a recordselection formula in crystal report but i need to pass extra one through vb that is why i specified strsel
which is a variable thru' which i'm going to pass another formula

abstract:

i already have one selection formula in crystal report and need to pass one more through vb. normally it is working but if u r specifying a variable in the record selection formula in crystal report it gives error messages

Tony

No comments:

Post a Comment