📄 frmadd1.frm
字号:
Left = 3120
TabIndex = 30
Top = 2880
Width = 1575
End
Begin VB.Label Label11
Caption = "【如:1988-08-16】"
Height = 495
Left = 3120
TabIndex = 29
Top = 2175
Width = 1575
End
Begin VB.Label Label10
Caption = "家庭住址"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 4680
TabIndex = 28
Top = 2880
Width = 975
End
Begin VB.Label Label9
Caption = "手 机"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 4680
TabIndex = 27
Top = 2190
Width = 855
End
Begin VB.Label Label8
Caption = "电 话"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 4680
TabIndex = 26
Top = 1500
Width = 855
End
Begin VB.Label Label7
Caption = "职 业"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 4680
TabIndex = 25
Top = 810
Width = 975
End
Begin VB.Label Label2
Caption = "住院号"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 4680
TabIndex = 24
Top = 120
Width = 975
End
Begin VB.Label Label6
Caption = "起病日期"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 0
TabIndex = 4
Top = 2880
Width = 975
End
Begin VB.Label Label5
Caption = "出生日期"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 0
TabIndex = 3
Top = 2190
Width = 975
End
Begin VB.Label Label4
Caption = "性 别"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 120
TabIndex = 2
Top = 1500
Width = 855
End
Begin VB.Label Label3
Caption = "姓 名"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 120
TabIndex = 1
Top = 810
Width = 855
End
Begin VB.Label Label1
Caption = "ID 号"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 120
TabIndex = 0
Top = 120
Width = 855
End
End
Attribute VB_Name = "FrmAdd1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If Data1.Recordset.RecordCount < 1 Then
MsgBox "数据库中没有数据", vbOKOnly + vbInformation, "系统消息"
Exit Sub
End If
Data1.Recordset.MoveFirst
End Sub
Private Sub Command2_Click()
If Data1.Recordset.RecordCount < 1 Then
MsgBox "数据库中没有数据", vbOKOnly + vbInformation, "系统消息"
Exit Sub
End If
Data1.Recordset.MovePrevious
If Data1.Recordset.BOF Then
Data1.Recordset.MoveFirst
End If
End Sub
Private Sub Command3_Click()
If Data1.Recordset.RecordCount < 1 Then
MsgBox "数据库中没有数据", vbOKOnly + vbInformation, "系统消息"
Exit Sub
End If
Data1.Recordset.MoveNext
If Data1.Recordset.EOF Then
Data1.Recordset.MoveLast
End If
End Sub
Private Sub Command4_Click()
If Data1.Recordset.RecordCount < 1 Then
MsgBox "数据库中没有数据", vbOKOnly + vbInformation, "系统消息"
Exit Sub
End If
Data1.Recordset.MoveLast
End Sub
Private Sub Command5_Click()
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
Command7.Enabled = True
Command8.Enabled = False
Text1.SetFocus
lockfalsh ' 解除琐定
Data1.Recordset.addnew
End Sub
Private Sub Command6_Click()
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
Command7.Enabled = True
Command8.Enabled = False
lockfalsh ' 解除琐定
If Data1.Recordset.RecordCount < 1 Then
MsgBox "当前没有记录,无法修改", vbQuestion + vbInformation, "系统消息"
Exit Sub
End If
Data1.Recordset.Edit
End Sub
Private Sub Command7_Click()
If Text1.Text = "" Then
MsgBox "ID号不能为空", vbOKOnly + vbQuestion, "系统信息"
Text1.SetFocus
Exit Sub
End If
If Text2.Text = "" Then
MsgBox "请填写姓名", vbOKOnly + vbQuestion, "系统信息"
Text2.SetFocus
Exit Sub
End If
If Combo1.Text = "" Then
MsgBox "请选择性别", vbOKOnly + vbQuestion, "系统信息"
Combo1.SetFocus
Exit Sub
End If
If Text3.Text = "" Then
MsgBox "请填写出生日期", vbOKOnly + vbQuestion, "系统信息"
Text3.SetFocus
Exit Sub
End If
If Text4.Text = "" Then
MsgBox "请填写起病日期", vbOKOnly + vbQuestion, "系统信息"
Text4.SetFocus
Exit Sub
End If
Data1.Recordset.Update
Data1.Refresh
MsgBox "保存成功", vbOKOnly + vbInformation, "系统消息"
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
Command5.Enabled = True
Command6.Enabled = True
Command7.Enabled = False
Command8.Enabled = True
locked '锁定
End Sub
Private Sub Command8_Click()
On Error GoTo err
If Data1.Recordset.RecordCount < 1 Then
MsgBox "数据库中没有数据", vbOKOnly + vbCritical, "系统消息"
Exit Sub
End If
Data1.Recordset.Delete
Data1.Recordset.MoveNext
If Data1.Recordset.EOF Then
Data1.Recordset.MoveLast
End If
err:
If err.Number = 3021 Then
MsgBox "无当前记录", vbOKOnly + vbCritical, "系统信息"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Combo1.Text = ""
Exit Sub
End If
End Sub
Private Sub Command9_Click()
Unload Me
FrmMdi.mnuadd1.Checked = False
End Sub
Private Sub Form_Load()
Data1.DatabaseName = App.Path & "\message.mdb"
Data1.RecordSource = "basic"
Data1.Refresh
locked '锁定
Command7.Enabled = False
Me.Height = 5295
Me.Width = 7905
Combo1.AddItem "男"
Combo1.AddItem "女"
End Sub
Sub locked() '锁定
Text1.locked = True
Text2.locked = True
Text3.locked = True
Text4.locked = True
Text5.locked = True
Text6.locked = True
Text7.locked = True
Text8.locked = True
Text9.locked = True
Combo1.locked = True
End Sub
Sub lockfalsh() ' 解除琐定
Text1.locked = False
Text2.locked = False
Text3.locked = False
Text4.locked = False
Text5.locked = False
Text6.locked = False
Text7.locked = False
Text8.locked = False
Text9.locked = False
Combo1.locked = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
FrmMdi.mnuadd1.Checked = False
End Sub
Private Sub Timer1_Timer()
Me.Height = 5295
Me.Width = 7905
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -