标题: 百思不解,求高医士 [打印本页] 作者: ZZBZZBZZZB 时间: 2009-6-3 11:47 标题: 百思不解,求高医士 Dim mysqln As String, mymax As Integer
Set rsNum = New ADODB.Recordset
Set rsNumm = New ADODB.Recordset
mysqln = "select max(凭证号) as mymax from 清单 " _
& "where month(日期)=" & Month(Now())
rsNum.Open mysqln, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
Label81.Caption = "本月最大编号为" & rsNum!mymax
Set rsNumm = New ADODB.Recordset
mysqln = "select sum(借方金额) as a1,sum(贷方金额) as a2 from 清单 " & "where month(日期)=" & Month(Now())
rsNumm.Open mysqln, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
If rsNumm!a1 <> rsNumm!a2 Then
凭证编号.Value = rsNum!mymax
Label82.Caption = "不平衡,建议编号为" & rsNum!mymax