hello,please help.how to display database field to report header .
for example:
from the database table have Department field.i want to display the Department name to report header.
this is the current code:
thanks for help1Code:Dim total As Double Dim strSQL As String Dim conDataConnection As Connection Dim empName As String Dim enddate As String Dim startdate As String Dim Department As String 'Dim rs As New Recordset empOTsummary.Orientation = rptOrientLandscape empOTsummary.Show empName = Cboempname.Text 'Department = rs1("Department") start = Format(DTPicker1.Value, "dd MMM yyyy") enddate = Format(DTPicker2.Value, "dd MMM yyyy") Set conDataConnection = New Connection conDataConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & App.Path & _ "\Overtime.mdb;Persist Security Info=False" Dim rs As New ADODB.Recordset strSQL = "SELECT * FROM Overtime where OvertimeDate BETWEEN #" & start & "# and #" & enddate & "# and EmployeeName='" & empName & "'" rs.Open strSQL, conDataConnection, adOpenStatic, adLockOptimistic While Not rs.EOF If IsNull(rs("OtHours").Value) Then total = total + 0 Else total = total + rs("OtHours").Value End If rs.MoveNext Wend 'display total at report footer empOTsummary.Sections("Section5").Controls.Item("Label15").Caption = Format(total, "#,##0.00") empOTsummary.Sections("Section4").Controls.Item("Label17").Caption = rs("Department") i use this method to display department name but have error message type miss match. empOTsummary.Sections("Section4").Controls.Item("Label19").Caption = start empOTsummary.Sections("Section4").Controls.Item("Label21").Caption = enddate 'set the database source in rs Set empOTsummary.DataSource = rs 'then set the field empOTsummary.Sections("section1").Controls.Item("Text1").DataField = "EmployeeName"![]()


Reply With Quote
