How do I send the data from a recordset to a datareport field?
I have
Set datareport1.datasource = RS
now how do I say what to put in label1 in the datareport?
Printable View
How do I send the data from a recordset to a datareport field?
I have
Set datareport1.datasource = RS
now how do I say what to put in label1 in the datareport?
Only controls with a DataField property can be bound to the recordset.
Before setting the DataSource property, set the DataField property to the name of a Field in the recordset.
Hello bomayed,
VB Code:
Set rsReport = New ADODB.Recordset 'rs is the recordset object rsReport.ActiveConnection = myConnectionString strSelect = "SELECT bla,bla,bla " _ & "FROM tblBla " _ & "Where Bla = blablabla " rsReport.Source = strSelect rsReport.Open Set drpt1.DataSource = rsReport drpt1.Sections("rptHeader").Controls("lblName").Caption = Trim(Adodc1.Recordset.Fields("pNAME")) drpt1t.Sections("rptHeader").Controls("lblAddress").Caption = some rs(field) here drpt1.Sections("rptHeader").Controls("lblCity").Caption = text1.text drpt1.Sections("rptHeader").Controls("lblZipCode").Caption = "01234" If rsReport.BOF = True And rsReport.EOF = True Then MsgBox "Data Not Found!!!", vbMsgBoxRight + vbMsgBoxRtlReading rsReport.Close Set rsReport = Nothing Exit Function End If If rsReport.Fields("bla").Value = 0 Then drpt1.Sections("Section5").Controls("Function4").Visible = False drpt1.Sections("Section5").Controls("Label12").Visible = False drpt1.Sections("Section5").Controls("Line9").Visible = False End If drpt1.Sections("rptHeader").Controls("lblHeadLine").Caption = "Head Line" drpt1.Sections("rptHeader").Controls("Label4").Caption = "something here..." drpt1.Show (1) rsReport.Close Set rsReport = Nothing
Just An Example,
Best Regards,
ERAN
Moved to Reporting section.