医院药品管理系统分析与设计 第12页 Private Sub cmdUpdate_Click()
On Error Resume Next
If Option3.Value = True Then
If txtFields(0) = "" Then
MsgBox ("请输入药品ID")
txtFields(0).SetFocus
ElseIf txtFields(1).Text = "" Then
MsgBox ("请输入药品名")
txtFields(1).SetFocus
ElseIf txtFields(8).Text = "" Then
MsgBox ("请输入采购数量")
txtFields(8).SetFocus
ElseIf IsNum(txtFields(8).Text) = False Then
MsgBox "“采购数量”请输入数字"
txtFields(8).Text = ""
txtFields(8).SetFocus
ElseIf IsNum(txtFields(9).Text) = False Then
MsgBox "“已售数量”请输入数字"
txtFields(9).Text = ""
txtFields(9).SetFocus
ElseIf Val(txtFields(9).Text) > Val(txtFields(8).Text) Then
MsgBox ("已售数量不能大于采购数量")
txtFields(9).Text = ""
txtFields(9).SetFocus
ElseIf txtFields(9).Text = "" Then
MsgBox ("请输入已售数量,如不填写则默认为“0”")
txtFields(9).Text = "0"
If txtFields(10) = "" Then
txtFields(10).Text=Val(txtFields(8).Text)-Val(txtFields(9).Text)
End If
Data1.UpdateRecord
Data1.Recordset.Bookmark=Data1.Recordset.LastModified
cmdCancle.Enabled = False
cmdAdd.Enabled = True
cmdDelete.Enabled = True
cmdFind.Enabled = True
cmdRefresh.Enabled = True
cmdBackup.Enabled = True
cmdEnter.Enabled = True
cmdReport.Enabled = True
Else
If txtFields(10) = "" Then
txtFields(10).Text=Val(txtFields(8).Text)-Val(txtFields(9).Text)
End If
Data1.UpdateRecord
Data1.Recordset.Bookmark = Data1.Recordset.LastModified
cmdCancle.Enabled = False
cmdAdd.Enabled = True
cmdRefresh.Enabled = True
cmdBackup.Enabled = True
cmdEnter.Enabled = True
cmdReport.Enabled = True
cmdOut.Enabled = True
cmdUpdate.Caption = "修改(&M)"
If Data1.Recordset.EOF And Data1.Recordset.BOF Then
cmdDelete.Enabled = False
cmdFind.Enabled = False
Image1.Visible = True
Frame1.Visible = False
Else: cmdDelete.Enabled = True
cmdFind.Enabled = True
End If
End If
ElseIf Option4.Value = True Then
If txtFields1(1) = "" Then
MsgBox ("请输入供货单位名称")
txtFields1(1).SetFocus
ElseIf txtFields1(2).Text = "" Then
MsgBox ("请输入联系人")
txtFields1(2).SetFocus
ElseIf txtFields1(3).Text = "" Then
MsgBox ("请输入联系电话")
txtFields1(3).SetFocus
Else
Data1.UpdateRecord
Data1.Recordset.Bookmark=Data1.Recordset.LastModified
cmdCancle.Enabled = False
cmdAdd.Enabled = True
cmdRefresh.Enabled = True
cmdBackup.Enabled = True
cmdEnter.Enabled = True
cmdReport.Enabled = True
cmdOut.Enabled = True
cmdUpdate.Caption = "修改(&M)"
End If
If Data1.Recordset.EOF And Data1.Recordset.BOF Then
cmdDelete.Enabled = False
cmdFind.Enabled = False
Image1.Visible = True
Frame1.Visible = False
Else: cmdDelete.Enabled = True
cmdFind.Enabled = True
End If
End If
End Sub
Private Sub cmdQuit_Click()
On Error Resume Next
Data1.UpdateControls
Unload Me
End Sub
Private Sub Data1_Error(DataErr As Integer, Response As Integer)
MsgBox "数据错误事件命中错误:" & Error$(DataErr)
Response = 0 '忽略错误
End Sub
Private Sub Data1_Reposition()
Screen.MousePointer = vbDefault
End Sub
Private Sub Data1_Validate(Action As Integer, Save As Integer)
Select Case Action
Case vbDataActionMoveFirst
Case vbDataActionMovePrevious
Case vbDataActionMoveNext
Case vbDataActionMoveLast
Case vbDataActionAddNew
Case vbDataActionUpdate
Case vbDataActionDelete
Case vbDataActionFind
Case vbDataActionBookmark
Case vbDataActionClose
End Select
Screen.MousePointer = vbDefault
End Sub
<< 上一页 [11] [12] [13] [14] [15] [16] [17] 下一页
医院药品管理系统分析与设计 第12页下载如图片无法显示或论文不完整,请联系qq752018766