Friday, February 24, 2012

help: Passing values to formula fields of subreport from the code in vb.net

hi,
i'm new in CR, i made a subreports(ReCaisse) in a main report(rptCaisseAll) and i established many formula fields in it, i want to fill the formula fields from the code in vb.net.
this is the code:
***********************************************
Dim SoCaisse As New ClsCaisse() //object caisse
Dim Report As New rptCaisseAll //main report
Dim r1 As New ReCaisse //Subreport

//
SoCaisse.GetRecord("Exchrate,AmountUS,AmountFc,s.Notes,s.DbCr,AccName,s.AccNo", "EntryDate=convert(datetime,''" & Me.txtDate.Text & "'',103)", "s.DbCr") //GetRecord establish sql statement

SoCaisse.SelectspecialMethod() //stored procedure

Report.Database.Tables.Item(0).SetDataSource(SoCaisse.CaisseSet.Tables(0))
Report.DataDefinition.FormulaFields.Item("Date").Text = "totext('" & Me.txtDate.Text & "')" // Date is a formula fields in rptCaisseAll-main report
Report.DataDefinition.FormulaFields.Item("SoldeUS").Text = "totext('" & Me.txtCUs.Text & "')" //SoldeUS is a formula fields in ReCaisse-subreport
**********************************************************
it passed the value to "Date" formula coz "Date" is a formula in the main report, but it not passed the value to "SoldeUS" formula fields; It appears blank.
so i tried:
***********************************
r1.DataDefinition.FormulaFields.Item("SoldeUS").Text = "totext('" & Me.txtCUs.Text & "')"
***********************************
but also not passed.

any help plz...
thanks.If Me.txtCUs.Text is a date then, format it

r1.DataDefinition.FormulaFields.Item("SoldeUS").Text = "totext('" & format(Me.txtCUs.Text,"dd-mmm-yyyy") & "')"

No comments:

Post a Comment