📄 frm_gzrz.frm
字号:
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "删除"
Key = "Del"
ImageIndex = 2
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "修改"
Key = "Edit"
ImageIndex = 3
EndProperty
BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "保存"
Key = "Save"
ImageIndex = 4
EndProperty
BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "取消"
Key = "Cancel"
ImageIndex = 5
EndProperty
BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "退出"
Key = "Exit"
ImageIndex = 6
EndProperty
BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
EndProperty
BorderStyle = 1
End
Begin VB.Label Label6
Caption = "记录人"
Height = 225
Left = 255
TabIndex = 8
Top = 3225
Width = 705
End
Begin VB.Line Line2
BorderColor = &H00008000&
Index = 1
X1 = 390
X2 = 4425
Y1 = 3030
Y2 = 3030
End
Begin VB.Line Line1
BorderColor = &H00008000&
Index = 1
X1 = 4410
X2 = 375
Y1 = 2985
Y2 = 2985
End
Begin VB.Label Label5
Caption = "内容"
Height = 255
Left = 210
TabIndex = 6
Top = 1395
Width = 435
End
Begin VB.Label Label4
Caption = "日志类型"
Height = 315
Left = 2415
TabIndex = 4
Top = 900
Width = 795
End
Begin VB.Label Label3
Caption = "日期"
Height = 210
Left = 2790
TabIndex = 2
Top = 3240
Width = 450
End
Begin VB.Label Label2
Caption = "序号"
Height = 225
Left = 210
TabIndex = 0
Top = 900
Width = 570
End
End
Attribute VB_Name = "frm_Gzrz"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i As Integer
Dim c
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text2.SetFocus
End If
End Sub
Private Sub DataGrid1_Click()
On Error Resume Next
If Adodc1.Recordset.RecordCount > 0 Then
Text1.Text = Adodc1.Recordset.Fields(0)
DT1.Value = Adodc1.Recordset.Fields(1)
Combo1.Text = Adodc1.Recordset.Fields(2)
Text2.Text = Adodc1.Recordset.Fields(3)
Text3.Text = Adodc1.Recordset.Fields(4)
End If
End Sub
Private Sub DT1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Call Saves
End If
End Sub
Private Sub Form_Load()
Call LoadFile
Call Tbr_cortrol(Tbr_xxcz, True)
Text3.Text = Name1
Text3.Enabled = False
Adodc1.ConnectionString = PublicStr
Adodc1.RecordSource = "select * from 工作日志 order by 序号"
Adodc1.Refresh
DT1.Value = Date
End Sub
Private Sub Tbr_xxcz_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Key
Case "Add"
Call Tbr_cortrol(Tbr_xxcz, False)
Text1.Text = ""
Text2.Text = ""
Combo1.Text = ""
AdoRs.Open "select * from 工作日志 where 序号 like '%" + Format(Date, "yyyymmdd") + "%' order by 序号", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
AdoRs.MoveLast
Text1.Text = Val(AdoRs.Fields("序号")) + 1
Else
Text1.Text = Format(Date, "yyyymmdd") & "001"
End If
AdoRs.Close
Combo1.SetFocus
DT1.Value = Date
Case "Del" '删除信息
Call Deletes
Case "Edit" '修改信息
Call Edits
Case "Save" '保存信息
Call Saves
Case "Cancel"
Call Tbr_cortrol(Tbr_xxcz, True)
Text1.Text = ""
Combo1.Text = ""
Text2.Text = ""
Text1.SetFocus
Case "Exit"
Unload Me
End Select
End Sub
Private Sub Saves() '保存信息的事件过程
If Combo1.Text = "" Or Text2.Text = "" Then
MsgBox "日志类型或内容不能空值", 48, "提示信息"
Else
AdoRs.Open "select * from 工作日志 where 序号='" + Text1.Text + "'", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
MsgBox "该信息已经存在", 48, "提示信息"
AdoRs.Close
Else
AdoRs.Close
c = MsgBox("确认保存信息吗?", 33, "提示信息")
If c = vbOK Then
Set AdoRs = Cnn.Execute("insert into 工作日志 values('" & Text1 _
& "','" & STR(DT1.Value) & "','" & Combo1 & "','" & Text2 & "','" & Text3 & "',' ',' ')")
MsgBox "数据保存成功", 64, "提示信息"
Call Refreshs
Else
End If
End If
Call Tbr_cortrol(Tbr_xxcz, True)
End If
End Sub
Private Sub Edits() '修改信息的事件过程
c = MsgBox("确认修改信息吗?", 33, "提示信息")
If c = vbOK Then
Set AdoRs = Cnn.Execute("UPDATE 工作日志 SET 序号='" + Text1 + "',日期='" + STR(DT1.Value) + "',日志类型='" + Combo1 + "',内容='" + Text2 + "',记录修改日期='" + STR(Date) + "',记录修改人='" + Name1 + "' where 序号='" + Text1.Text + "'")
MsgBox "数据修改成功", 64, "提示信息"
StrId = Text1.Text
StrTitle = Text3.Text
Call joinRZ
Call Refreshs
Else
End If
End Sub
Private Sub LoadFile()
AdoRs.Open "select * from 工作日志", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
Text1.Text = AdoRs.Fields("序号")
DT1.Value = AdoRs.Fields("日期")
Combo1.Text = AdoRs.Fields("日志类型")
Text2.Text = AdoRs.Fields("内容")
Text3.Text = AdoRs.Fields("用户名")
End If
AdoRs.Close
End Sub
Private Sub Deletes() '删除信息
c = MsgBox("确认删除该信息吗?", 17, "提示信息")
If c = vbOK Then
Set AdoRs = Cnn.Execute("Delete 工作日志 from 工作日志 where 序号='" + Text1.Text + "'")
End If
Text1.Text = ""
Text2.Text = ""
Combo1.Text = ""
Call Refreshs
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
DT1.SetFocus
End If
End Sub
Private Sub Refreshs()
Adodc1.RecordSource = "select * from 工作日志 order by 序号"
Adodc1.Refresh
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -