Private Sub btnPrint_Click()
    Dim dr As New DataReport1
    Dim de As DataEnvironment1
    Dim rs As Recordset
    Dim sql As String
'initialize variable sql
    sql = ""
'按学号查询
    If Check1.Value = vbChecked Then
       sql = sql & " And BadgeID='" & Trim(txbId.Text & " ") & "'"
    End If
'按学生姓名查询
    If Check2.Value = vbChecked Then
       sql = sql & "and Student_Name='" & Trim(txbName.Text & " ") & "'"
    End If
'按课程名称查询
    If Check3.Value = vbChecked Then
       sql = sql & "and  LessonName='" & Trim(txbLesson.Text & " ") & "'"
    End If
'按班级查询
    If Check4.Value = vbChecked Then
       sql = sql & "and Class_Name='" & Trim(txbClass.Text & " ") & "'"
    End If    If Trim(sql) = "" Then
       MsgBox "请选择查询方式!", vbOKOnly + vbExclamation
       Exit Sub
    End If
    
    Adodc1.RecordSource = "select Students.Student_Id,Student_Name,BadgeID,Class_Name,LessonName,Score from Students,Classes,Lessons,Scores where Students.Student_Id=Scores.Student_Id AND Lessons.LessonId=Scores.LessonId  AND Classes.Class_Id=Students.Class_Id " & sql
    Adodc1.CommandType = adCmdText
    Adodc1.Refresh
    grdDataGrid.ReBind
    grdDataGrid.AllowAddNew = False
    grdDataGrid.AllowDelete = False
    grdDataGrid.AllowUpdate = False    Set de = dr.DataSource
    Set de.rsCommand1.DataSource = rs
    dr.Show 1
End Sub以上是我的打印代码。我要用DataEnvironment的一个connection连接中的4个command表中的字段数据,实现用DataReport生成一个报表打印,需要打印的字段从左到右的排列为Command3中的BadgeID、Student_Name,Command4中的Class_Name,Command2中的LessonName,Command1中的Score。由于上面打印代码与查询结果有联系,要实现报表跟随查询结果及时更新。在调试过程中老是显示:“未找到DataField'command1.Student_Name'等错误  ,请高手们指点下,上面的代码应该怎么改啊?????????