Public Sub xxxuefeidata()
Dim mrc As ADODB.Recordset
Dim mrc1 As ADODB.Recordset
txtsql = "select jf.卡号,xj.姓名,xj.班级,jf.时限,jf.交费,jf.欠费,jf.日期,jf.操作员 from jf inner join xj on jf.学号=xj.卡号 where jf.卡号='" & Trim(frmjf2.MSF1.TextMatrix(frmjf2.MSF1.Row, 1)) & "' order by jf.日期"
Set mrc = ExecuteSQL(txtsql)
txtsql = "select 卡号,sum(交费),sum(欠费) from jf where 卡号='" & Trim(frmjf2.MSF1.TextMatrix(frmjf2.MSF1.Row, 1)) & "' group by 卡号 order by 卡号"
Set mrc1 = ExecuteSQL(txtsql)
Dim j As Integer
Dim i As Integer
If mrc.EOF = True Then             就是这句总是出错。
 MSF1.Clear
 Exit Sub
End If
mrc.MoveFirst
With MSF1
 .Rows = 3
    .Row = 1
 Do While Not mrc.EOF
   .Rows = .Rows + 1
   For i = 0 To 2
  Text1(i) = mrc.Fields(i)
Next i
    .TextMatrix(.Row, 1) = mrc.Fields(3)
   .TextMatrix(.Row, 2) = "¥" & Format(mrc.Fields(4), "0.00")
   If Val(mrc.Fields(5)) >= 0 Then
    .TextMatrix(.Row, 3) = "¥" & Format(mrc.Fields(5), "0.00")
   Else
      .TextMatrix(.Row, 3) = "-¥" & Format(-Val(mrc.Fields(5)), "0.00")
   End If
       .TextMatrix(.Row, 4) = mrc.Fields(6)
        .TextMatrix(.Row, 5) = mrc.Fields(7)
     
   .Row = .Row + 1
        mrc.MoveNext
 Loop  .Row = .Row + 1
  .Col = 1
   MSF1.CellForeColor = vbRed
   .TextMatrix(.Row, 1) = "累计交费:"
   .Col = 2
     MSF1.CellForeColor = vbRed
     .TextMatrix(.Row, 2) = "¥" & Format(mrc1.Fields(1), "0.00") & " 元"
     .Col = 4
      MSF1.CellForeColor = vbRed
      .TextMatrix(.Row, 4) = "累计欠费:"
       .Col = 5
     MSF1.CellForeColor = vbRed
      .TextMatrix(.Row, 5) = "¥" & Format(mrc1.Fields(2), "0.00") & " 元"
      
 End With
   
End SubPrivate Sub Form_Activate()
xxjfshowtitle
xxxuefeidata
End SubPrivate Sub MSF1_Click()
Text2.Visible = False
MSF1.SetFocus
End SubPrivate Sub MSF1_DblClick()
With MSF1
Dim c As Integer
Dim r As Integer
r = .Row
c = .Col
If c = 1 Or r = .Rows - 1 Or r = .Rows - 2 Then
Dim ss As String
ss = MsgBox("该项不能修改!", vbExclamation + vbOKOnly, " 警告")
Exit Sub
End If
qxstr = Executeqx(3)
  If qxstr = "readonly" Then
  ss = MsgBox("对不起,你是只读用户不能修改记录,请与管理员联系!", vbInformation + vbOKOnly, " 警告")
  Exit Sub
   End If
Text2.Top = .Top + .RowPos(r) + 15
Text2.Left = .Left + .ColPos(c) + 25
Text2.Width = .ColWidth(c)
Text2.Height = .RowHeight(r) - 15
Text2.Text = .Text
    Text2.SelStart = 0
   Text2.SelLength = Len(Text2.Text)
Text2.Visible = True
Text2.SetFocusEnd With
End Sub