医院药品管理系统分析与设计 第10页 图6-2 药品基本信息窗体
图6-3 供货商信息窗体
程序代码如下:
Dim s, f
Dim i As Integer
Dim j As Integer
Private Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" _
(ByVal lpExistingFileName As String, _
ByVal lpNewFileName As String, _
ByVal bFailIfExists As Long) _
As Long ‘复制文件的API函数
Private Function IsNum(Num As Variant) As Boolean ‘判断返回值是否是数字
On Error GoTo aaaa
Num = Num / 2
IsNum = True
Exit Function
aaaa:
IsNum = False
End Function
Sub CenterForm(frm As Form) ‘使窗体居中
frm.Move (Screen.Width - frm.Width) \ 2, (Screen.Height - frm.Height) \ 2
End Sub
Private Sub About_Click(Index As Integer)
frmAbout.Show vbModal ‘显示模式窗体
End Sub
Private Sub Backup_Click(Index As Integer)
cmdBackup_Click ‘打开备份对话框
End Sub
Private Sub change_Click()
On Error Resume Next
登陆.Show ‘更换用户
Unload Me
Unload frmAbout
Unload frmForm3
End Sub
Private Sub cmdAdd_Click()
On Error Resume Next
Static d
Data1.Recordset.AddNew ‘添加新记录
cmdUpdate.Caption = "保存(&S)"
If Option3.Value = True Then
txtFields(1).SetFocus
Else
txtFields1(1).SetFocus
End If
cmdUpdate.Enabled = True
cmdCancle.Enabled = True
cmdAdd.Enabled = False
cmdDelete.Enabled = False
cmdFind.Enabled = False
cmdRefresh.Enabled = False
cmdBackup.Enabled = False
cmdEnter.Enabled = False
cmdReport.Enabled = False
cmdOut.Enabled = False
Image1.Visible = True
Frame1.Visible = False
d = d + 1 ‘自动添加编号
If Len(d) = 1 Then
d = 0 & 0 & d
ElseIf Len(d) = 2 Then
d = 0 & d
End If
s = Format(Date, "yyyymmd")
f = s & d
If Option3.Value = True Then
txtFields(0).Text = f
Else
txtFields1(0).Text = f
End If
If Left(d, 2) = (0 & 0) Then
d = Val(Right(d, 1))
ElseIf Left(d, 1) = 0 Then
d = Val(Right(d, 2))
End If
End Sub
Private Sub cmdBackup_Click() ‘备份数据库
On Error Resume Next
Dim str_Source As String
Dim str_Dest As String
str_Source = App.Path & "\date\date.mdb"
If str_Source <> "" Then
Me.CommonDialog1.DialogTitle = "请输入目标文件"
Me.CommonDialog1.ShowSave
str_Dest = Me.CommonDialog1.FileName
If str_Dest <> "" Then
'FileCopy str_Source, str_Dest
CopyFile str_Source, str_Dest, True
'CopyFile str_Source, str_Dest, False
End If
End If
End Sub
Private Sub cmdCancle_Click()
On Error Resume Next
If MsgBox("是否放弃添加?", vbYesNo, "信息提示") = vbYes Then
Data1.UpdateControls ‘放弃添加
Data1.Refresh
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
cmdAdd.Enabled = True
cmdCancle.Enabled = False
cmdFind.Enabled = True
cmdRefresh.Enabled = True
cmdBackup.Enabled = True
cmdEnter.Enabled = True
cmdReport.Enabled = True
cmdOut.Enabled = True
cmdUpdate.Caption = "修改(&M)"
Else: '???????
End If
End Sub
Private Sub cmdDelete_Click()
On Error Resume Next
If MsgBox("真的要删除当前记录吗?", vbYesNo, "信息提示") = vbYes Then
Data1.Recordset.Delete
Data1.Recordset.MoveNext
If Data1.Recordset.EOF Then
Data1.Recordset.MoveFirst
If Data1.Recordset.BOF Then
cmdDelete.Enabled = False
cmdFind.Enabled = False
Image1.Visible = True
Frame1.Visible = False
End If
End If
End If
End Sub
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >>
医院药品管理系统分析与设计 第10页下载如图片无法显示或论文不完整,请联系qq752018766