注册 登录
编程论坛 VB6论坛

代码怎样解释?

sa1888 发布于 2013-08-20 12:34, 460 次点击
Private Sub CommandButton2_Click()
  Dim Moth As Integer
  Dim Maxrow As Integer, I As Integer
  Dim CNN As New ADODB.Connection
  Dim RS As New ADODB.Recordset
  Dim pthStr As String
  Dim SQL As String
  Application.ScreenUpdating = False
  pthStr = ThisWorkbook.Path & Application.PathSeparator & "分录表2013.mdb"
  CNN.Open "provider=Microsoft.jet.OLEDB.4.0;data source=" & pthStr
  Sheets("总分类账").[G4] = Format(, "00") & "月"
  Maxrow = [A65536].End(xlUp).Row
  If ComboBox1.Value = "" Then
  CNN.Close
  Exit Sub
  Else
  PBar1.Max = Maxrow - 7
  For I = 7 To Maxrow
  PBar1.Value = I - 7
  SQL = " Select sum(iif(isnull(借方金额),0,借方金额)),sum(iif(isnull(贷方金额),0,贷方金额)) from (" & _
        "select 月,借方金额,贷方金额 from flb where 科目编码 like '" & CStr(Cells(I, 1)) & "') where 月=" & CInt(ComboBox1.Value)
  RS.Open SQL, CNN, adOpenKeyset, adLockOptimistic
  Cells(I, "F").CopyFromRecordset RS
  Set RS = Nothing
  Next I
  PBar1.Max = Maxrow - 7
  For I = 7 To Maxrow
  PBar1.Value = I - 7
  SQL = " Select sum(iif(isnull(借方金额),0,借方金额)),sum(iif(isnull(贷方金额),0,贷方金额)) from (" & _
        "select 月,借方金额,贷方金额 from flb where 科目编码 like '" & CStr(Cells(I, 1)) & "') where 月<=" & CInt(ComboBox1.Value)
  RS.Open SQL, CNN, adOpenKeyset, adLockOptimistic
  Cells(I, "H").CopyFromRecordset RS
  Set RS = Nothing
  Next I
  End If
  CNN.Close
  Call 合计
  Unload Me
  Application.ScreenUpdating = True
  MsgBox "总分类账的数据汇总完毕!", vbInformation, "凭证处理系统"
End Sub
2 回复
#2
sa18882013-08-20 12:45
请高手们帮帮解释一下。急求!!!












#3
tonoy2013-08-25 18:08
你这不是纯属的伸手党么?
1