我看了下,就是那个FSE窗体,运行后,除了TEXT121其他正常啊?
一打开FSE窗口,点合计按钮,就出现与其他TEXT121的不太一样小数位的数值!
我又把数据类型改为文本型,结果还是一样!
另外,
我想把每个记录中Z(I)字段值=“银行存款”时对应的J(I)或D(I)的值排列输出来!
以前是总计数,代码如下:
For i2 = 1 To 9
s2 = "Select Sum([j(" & i2 & ")]) from fl2 where [z(" & i2 & ")]='银行存款' GROUP BY [Z(" & i2 & ")]"
If conn.Execute(s2).EOF = False And IsNull(conn.Execute(s2)(0)) = False Then
a2 = a2 + conn.Execute(s2)(0)
End If
Next
现在为实现全部一一输出排列显示出来,而不是统计,改为:
Private Sub Command1_Click()
Dim jj, ss, ii As Integer
Dim mysql As String
For jj = 1 To 9
mysql = "select * from fl2 where [z(" & jj & ")]='银行存款' "
If Conn.Execute(mysql).EOF = False And IsNull(Conn.Execute(mysql)(0)) = False Then
Set Rst = Conn.Execute(mysql)
End If
ss = Rst.Fields.Count
If Rst.BOF = True Then
MsgBox "no!"
Else
Set DataGrid1.DataSource = Rst
For ii = 0 To ss - 1
DataGrid1.Columns(ii).Alignment = dbgCenter
DataGrid1.Columns(ii).Width = 1000
Next ii
DataGrid1.AllowUpdate = False
End If
Next
End Sub
怎么就显示一个记录呢?
没有实现循环???!!!
下面这段可不可以放到公共模块里去?
Option Explicit
Private conn As ADODB.Connection
Private Rst As New ADODB.Recordset