商品销售管理系统 第8页
End Sub
'更新某个字段
Private Sub DataGrid1_SelChange(Cancel As Integer)
On Error Resume Next
Adodc1.Recordset.Fields("剩余数量").Value = Adodc1.Recordset.Fields("库存数量").Value - xskd_frm.DataGrid1.Columns(7).Value
xskd_frm.Adodc1.Recordset.MoveNext
End Sub
Private Sub find_cmd_Click()
'按字段查找
If Combo2.Text = "like" Then
Adodc1.RecordSource = "select * from 商品信息表 where " & Combo1.Text & " " & Combo2.Text & "' % " & Text1.Text & " % '"
Adodc1.Refresh
Else
Adodc1.RecordSource = "select * from 商品信息表 where " & Combo1.Text & " " & Combo2.Text & "'" & Text1.Text & " '"
Adodc1.Refresh
End If
St1.Panels(1).Text = "记录数: " & DataGrid1.ApproxCount & " " & "条" & " " & "当前记录为:"
End Sub
Private Sub Form_Load()
cbooperators Combo2 '调用查询操作符
Combo2.ListIndex = 0
Call cnn
rs1.Open "select * from 商品信息表 ", cn, adOpenKeyset, adLockOptimistic
rs2.Open "select * from 销售信息表 ", cn, adOpenKeyset, adLockOptimistic
Dim fld
For Each fld In rs1.Fields '添加字段
Combo1.AddItem fld.Name
Next fld
rs1.Close
Combo1.ListIndex = 0
DataGrid1.MarqueeStyle = dbgDottedCellBorder
'在状态栏上显示记录数和当前的第几条
St1.Panels(1).Text = "记录数: " & DataGrid1.ApproxCount & " " & "条" & " " & "当前记录为:"
St1.Panels(1).Width = 3600
St1.Panels.Add
St1.Panels(2).Text = Label1.Caption
St1.Panels(2).Width = 600
St1.Panels.Add
St1.Panels(3).Text = "条"
St1.Panels(3).Width = 600
rs2.Close
cn.Close
End Sub