如何逐行填充数据报表

时间:2017-07-10 16:23:00

标签: vb6 report record

我必须使用Data Report更改用Vb6编写的非常旧的应用程序。 实际上只显示一个名为txtdata的字段的查询记录。

现在我将始终显示一个字段(txtdata),但文本大小和样式不同,具体取决于它是否以#开头。

我想查看记录是否以#开头的记录,并为每条记录设置文字样式和大小。

我该怎么办?

 Dim rs As Adodb.Recordset
 Dim sql As String
 Dim regtratt As  
 .................
 ' I have a Data Report with textbox named txtdata in Section1  
 sql = ""
 sql = sql + "SELECT txtdata "
 sql = sql + "FROM journal "
 sql = sql + "WHERE cod=421 "
 sql = sql + "ORDER BY id "

 Set rs = xOpenRecordset(sql, cnOnline)
 If rs.RecordCount > 0 Then

    Set regtratt.DataSource = rs
        regtratt.DataMember = ""

    ' I want to change the font according to the text but I don't know how to because DataSource=rs takes the records.                         
        'If InStr("#", regtratt.Sections("Section1").Controls(1).Item.Value) Then
        '    regtratt.Sections("Section1").Controls(1).Font.size = 20
        '    regtratt.Sections("Section1").Controls(1).Font.Bold = True
        'End If

      regtratt.Orientation = rptOrientLandscape
      regtratt.WindowState = vbMaximized
      regtratt.Font.Name = "courier new"
      regtratt.Refresh
      regtratt.Show vbModal
      Unload regtratt

 Else
      MsgBox ("Sorry No data")

 End If

0 个答案:

没有答案