图6-6 商品管理界面
2.主要代码 Dim yf%
Private Sub Command3_Click() On Error Resume Next If yf <> 0 Then
MsgBox \现在正在执行其他操作,不能进行查询!\提示\Exit Sub End If
If Combo1.Text = \
MsgBox \请选择要查询的字段!\提示\ Combo1.SetFocus Exit Sub End If
If Text2.Text = \
MsgBox \请输入要查询的条件!\提示\ Text2.SetFocus Exit Sub End If
If Combo1.Text = \商品编号\
rst.Open \商品编号='\+ \
If rst.RecordCount = 0 Then
MsgBox \没有要查询的记录!\提示\ End If rst.Close
Adodc1.RecordSource = \商品编号='\Trim(Text2.Text) + \ Adodc1.Refresh
ElseIf Combo1.Text = \商品名称\
rst.Open \商品名称='\+ \
If rst.RecordCount = 0 Then
MsgBox \没有要查询的记录!\提示\ End If rst.Close
Adodc1.RecordSource = \商品名称='\Trim(Text2.Text) + \ Adodc1.Refresh Else
MsgBox \请选择要查询的正确字段!\提示\End If End Sub
Private Sub Command4_Click()
Adodc1.RecordSource = \价格\ Adodc1.Refresh End Sub
Private Sub Command5_Click()
Adodc1.RecordSource = \用途\ Adodc1.Refresh End Sub
Private Sub Form_Load() Adodc1.ConnectionString = \Server};server=(local);database=mry\
Adodc1.RecordSource = \ Adodc1.Refresh End Sub
Private Sub Command1_Click() On Error Resume Next If yf = 1 Then '新增
rst.Open \* From shangpin\Cnn, adOpenKeyset, adLockOptimistic Call Check(\商品编号\ If Fh = 1 Then rst.Close Fh = 0 Exit Sub
End If
'----------------------------------------- rst.AddNew
For i = 0 To 6
rst.Fields(i) = Text1(i) Next i
rst.Fields(\入库时间\ rst.Update