Click to See Complete Forum and Search --> : Sending Data to Datareport
bomayed
Dec 14th, 2005, 07:37 AM
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?
brucevde
Dec 14th, 2005, 10:30 AM
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.
eranfox
Dec 14th, 2005, 12:38 PM
Hello bomayed,
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
Hack
Dec 15th, 2005, 12:31 PM
Moved to Reporting section.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.