📄 frm_gzjh.frm
字号:
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 Label8
Caption = "计划内容"
Height = 240
Left = 120
TabIndex = 15
Top = 1740
Width = 795
End
Begin VB.Label Label7
Caption = "结束时间"
Height = 255
Left = 2340
TabIndex = 13
Top = 1365
Width = 825
End
Begin VB.Label Label1
Caption = "开始时间"
Height = 240
Left = 120
TabIndex = 11
Top = 1365
Width = 885
End
Begin VB.Label Label6
Caption = "制作人"
Height = 225
Left = 135
TabIndex = 7
Top = 3435
Width = 705
End
Begin VB.Line Line2
BorderColor = &H00008000&
Index = 1
X1 = 300
X2 = 4335
Y1 = 3240
Y2 = 3240
End
Begin VB.Line Line1
BorderColor = &H00008000&
Index = 1
X1 = 4320
X2 = 285
Y1 = 3195
Y2 = 3195
End
Begin VB.Label Label5
Caption = "备注"
Height = 255
Left = 120
TabIndex = 6
Top = 2445
Width = 435
End
Begin VB.Label Label4
Caption = "计划状态"
Height = 315
Left = 2340
TabIndex = 4
Top = 930
Width = 795
End
Begin VB.Label Label3
Caption = "制作日期"
Height = 210
Left = 2400
TabIndex = 2
Top = 3435
Width = 765
End
Begin VB.Label Label2
Caption = "序号"
Height = 225
Left = 225
TabIndex = 0
Top = 960
Width = 570
End
End
Attribute VB_Name = "frm_Gzjh"
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
DT_S.SetFocus
End If
End Sub
Private Sub DataGrid1_Click()
On Error Resume Next
If Adodc1.Recordset.RecordCount > 0 Then
Text1(0).Text = Adodc1.Recordset.Fields(0)
DT_S.Value = Adodc1.Recordset.Fields(1)
DT_E.Value = Adodc1.Recordset.Fields(2)
Text1(1).Text = Adodc1.Recordset.Fields(3)
Text1(2).Text = Adodc1.Recordset.Fields(4)
Txt_P.Text = Adodc1.Recordset.Fields(5)
DT_Date.Value = Adodc1.Recordset.Fields(6)
Combo1.Text = Adodc1.Recordset.Fields(7)
End If
End Sub
Private Sub DT_Date_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Call Saves
End If
End Sub
Private Sub DT_E_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text1(1).SetFocus
End If
End Sub
Private Sub DT_S_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
DT_E.SetFocus
End If
End Sub
Private Sub Form_Load()
Call LoadFile
Call Tbr_cortrol(Tbr_xxcz, True)
Txt_P.Text = Name1
Txt_P.Enabled = False
Adodc1.ConnectionString = PublicStr
Adodc1.RecordSource = "select * from 工作计划 order by 序号"
Adodc1.Refresh
End Sub
Private Sub Tbr_xxcz_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Key
Case "Add"
Call Tbr_cortrol(Tbr_xxcz, False)
For i = 0 To 2
Text1(i).Text = ""
Text1(i).Locked = False
Next i
Combo1.Text = ""
AdoRs.Open "select * from 工作计划 where 序号 like '%" + Format(Date, "yyyymmdd") + "%' order by 序号", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
AdoRs.MoveLast
Text1(0).Text = Val(AdoRs.Fields("序号")) + 1
Else
Text1(0).Text = Format(Date, "yyyymmdd") & "01"
End If
AdoRs.Close
Combo1.SetFocus
Case "Del" '删除信息
Call Deletes
Case "Edit" '修改信息
Call Edits
Case "Save" '保存信息
Call Saves
Case "Cancel"
Call Tbr_cortrol(Tbr_xxcz, True)
For i = 0 To 2
Text1(i).Text = ""
Text1(i).Locked = True
Next i
Combo1.Text = ""
Text1(0).SetFocus
Case "Exit"
Unload Me
End Select
End Sub
Private Sub Saves() '保存信息的事件过程
If Combo1.Text = "" Or Text1(1).Text = "" Then
MsgBox "计划状态或内容不能空值", 48, "提示信息"
Else
AdoRs.Open "select * from 工作计划 where 序号='" + Text1(0).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(0) _
& "','" & STR(DT_S.Value) & "','" & STR(DT_E.Value) & "','" & Text1(1) _
& "','" & Text1(2) & "','" & Name1 & "','" & STR(DT_Date.Value) & "','" & Combo1 & "',' ',' ')")
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(0) + "',开始时间='" + STR(DT_S.Value) + "',结束时间='" + STR(DT_E.Value) + "',计划状态='" + Combo1 + "',计划内容='" _
+ Text1(1) + "',备注='" + Text1(2) + "',制作日期='" + STR(DT_Date) + "',记录修改日期='" + STR(Date) + "',记录修改人='" + Name1 + "' where 序号='" + Text1(0).Text + "'")
MsgBox "数据修改成功", 64, "提示信息"
StrId = Text1(0).Text
StrTitle = Txt_P.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(0).Text = AdoRs.Fields(0)
DT_S.Value = AdoRs.Fields(1)
DT_E.Value = AdoRs.Fields(2)
Text1(1).Text = AdoRs.Fields(3)
Text1(2).Text = AdoRs.Fields(4)
Txt_P.Text = AdoRs.Fields(5)
DT_Date.Value = AdoRs.Fields(6)
Combo1.Text = AdoRs.Fields(7)
End If
AdoRs.Close
End Sub
Private Sub Deletes() '删除信息
c = MsgBox("确认删除该信息吗?", 17, "提示信息")
If c = vbOK Then
Set AdoRs = Cnn.Execute("Delete 工作计划 from 工作计划 where 序号='" + Text1(0).Text + "'")
End If
For i = 0 To 2
Text1(i).Text = ""
Next i
Combo1.Text = ""
Call Refreshs
End Sub
Private Sub Refreshs()
Adodc1.RecordSource = "select * from 工作计划 order by 序号"
Adodc1.Refresh
End Sub
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
If Index = 0 Then
AdoRs.Open "select * from 工作计划 where 序号='" + Text1(0).Text + "'", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
Text1(0).Text = AdoRs.Fields(0)
DT_S.Value = AdoRs.Fields(1)
DT_E.Value = AdoRs.Fields(2)
Text1(1).Text = AdoRs.Fields(3)
Text1(2).Text = AdoRs.Fields(4)
Txt_P.Text = AdoRs.Fields(5)
DT_Date.Value = AdoRs.Fields(6)
Combo1.Text = AdoRs.Fields(7)
End If
AdoRs.Close
ElseIf Index = 1 Then
Text1(2).SetFocus
ElseIf Index = 2 Then
DT_Date.SetFocus
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -