📄 frm_hysgl.frm
字号:
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.Line Line2
BorderColor = &H00008000&
X1 = 285
X2 = 6420
Y1 = 3090
Y2 = 3090
End
Begin VB.Label Label6
Caption = "备注信息"
Height = 270
Left = 195
TabIndex = 11
Top = 2280
Width = 885
End
Begin VB.Label Label5
Caption = "座位数"
Height = 315
Left = 195
TabIndex = 10
Top = 1830
Width = 1125
End
Begin VB.Label Label4
Caption = "会议室名称"
Height = 240
Left = 180
TabIndex = 8
Top = 1395
Width = 1290
End
Begin VB.Label Label3
Caption = "编号"
Height = 210
Left = 195
TabIndex = 5
Top = 960
Width = 585
End
Begin VB.Label Label2
Caption = "记录修改人"
Height = 255
Left = 4395
TabIndex = 3
Top = 3315
Width = 960
End
Begin VB.Label Label1
Caption = "记录修改日期"
Height = 225
Left = 1485
TabIndex = 1
Top = 3330
Width = 1140
End
Begin VB.Line Line1
BorderColor = &H00008000&
X1 = 285
X2 = 6420
Y1 = 3060
Y2 = 3060
End
End
Attribute VB_Name = "frm_hysgl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i As Integer
Dim c
Private Sub Dgr_Sjll_Click()
On Error Resume Next
If Adodc1.Recordset.RecordCount > 0 Then
Text1(0).Text = Adodc1.Recordset.Fields("hys_id")
Text1(1).Text = Adodc1.Recordset.Fields("hys_mc")
Text1(2).Text = Adodc1.Recordset.Fields("hys_zws")
Text1(3).Text = Adodc1.Recordset.Fields("hys_bz")
Txt_Date.Text = Adodc1.Recordset.Fields("hys_xgrq")
Txt_xgr.Text = Adodc1.Recordset.Fields("hys_xgr")
End If
For i = 0 To 3
Text1(i).Locked = False
Next i
End Sub
Private Sub DT1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text1(4).SetFocus
End If
End Sub
Private Sub Form_Load()
Call LoadFile
For i = 1 To 3
Text1(i).Locked = True
Next i
Adodc1.ConnectionString = PublicStr
Adodc1.RecordSource = "select * from 会议室管理 order by hys_id"
Adodc1.Refresh
Call DBGCon
Call Tbr_cortrol(Tbr_xxcz, True)
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 3
Text1(i).Locked = False
Text1(i).Text = ""
Text1(0).SetFocus
Next i
AdoRs.Open "select * from 会议室管理 order by hys_id", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
AdoRs.MoveLast
StrNum = Mid(AdoRs.Fields("hys_id"), 2, Len(AdoRs.Fields("hys_id")))
Call Con_idNum '调用位数转换函数
Text1(0).Text = "R" & StrIn
Else
Text1(0).Text = "R001"
End If
AdoRs.Close
Case "Del" '删除信息
Call Deletes
Call DBGCon
Case "Edit" '修改信息
Call Edits
Call DBGCon
Case "Save" '保存信息
Call Saves
Call DBGCon
Case "Cancel"
Call Tbr_cortrol(Tbr_xxcz, True)
For i = 1 To 3
Text1(i).Text = ""
Text1(1).SetFocus
Text1(i).Locked = True
Next i
Adodc1.RecordSource = "select * from 会议室管理 order by hys_id"
Adodc1.Refresh
Call DBGCon
Case "Exit"
Unload Me
End Select
End Sub
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
On Error Resume Next
If Index < 4 And KeyCode = 38 Then Text1(Index - 1).SetFocus
If Index >= 0 And KeyCode = 40 Then Text1(Index + 1).SetFocus
If Index >= 0 And KeyCode = 13 Then Text1(Index + 1).SetFocus
If Index = 3 And KeyCode = 13 Then
Call Saves
End If
End Sub
Private Sub Saves() '保存信息的事件过程
If Text1(0).Text = "" Or Text1(1).Text = "" Then
MsgBox "重要信息不能为空值", 48, "提示信息"
Else
If IsNumeric(Text1(2)) Then
AdoRs.Open "select * from 会议室管理 where hys_mc='" + Text1(1).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) _
& "','" & Text1(1) & "','" & Text1(2) & "','" & Text1(3) & "',' ',' ')")
MsgBox "数据保存成功", 64, "提示信息"
Else
End If
Adodc1.RecordSource = "select * from 会议室管理 order by hys_id"
Adodc1.Refresh
Call DBGCon
End If
Call Tbr_cortrol(Tbr_xxcz, True)
Else
MsgBox "输入的座位数值非法", 48, "提示信息"
Text1(2).Text = ""
Text1(2).SetFocus
End If
End If
End Sub
Private Sub Edits() '修改信息的事件过程
c = MsgBox("确认修改信息吗?", 33, "提示信息")
If c = vbOK Then
Set AdoRs = Cnn.Execute("UPDATE 会议室管理 SET hys_id='" + Text1(0) + "',hys_mc='" + Text1(1) + "',hys_zws='" + Text1(2) + "',hys_bz='" + Text1(3) + "',hys_xgrq='" + STR(Date) + "',hys_xgr='" + Name1 + "' where hys_id='" + Text1(0).Text + "'")
MsgBox "数据修改成功", 64, "提示信息"
Adodc1.RecordSource = "select * from 会议室管理 order by hys_id"
Adodc1.Refresh
StrId = Text1(0).Text
StrTitle = Text1(1).Text
Call joinRZ
Call DBGCon
Else
End If
End Sub
Private Sub LoadFile()
AdoRs.Open "select * from 会议室管理", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
Text1(0).Text = AdoRs.Fields("hys_id")
Text1(1).Text = AdoRs.Fields("hys_mc")
Text1(2).Text = AdoRs.Fields("hys_zws")
Text1(3).Text = AdoRs.Fields("hys_bz")
Txt_Date.Text = AdoRs.Fields("hys_xgrq")
Txt_xgr.Text = AdoRs.Fields("hys_xgr")
End If
AdoRs.Close
End Sub
Private Sub Deletes() '删除信息
c = MsgBox("确认删除该信息吗?", 17, "提示信息")
If c = vbOK Then
Set AdoRs = Cnn.Execute("Delete 会议室管理 from 会议室管理 where hys_id='" + Text1(0).Text + "'")
Adodc1.Refresh
End If
For i = 0 To 3
Text1(i).Text = ""
Next i
End Sub
Private Sub DBGCon()
Dgr_Sjll.Columns(0).Caption = "编号"
Dgr_Sjll.Columns(1).Caption = "会议室名称"
Dgr_Sjll.Columns(2).Caption = "座位数"
Dgr_Sjll.Columns(3).Caption = "备注信息"
Dgr_Sjll.Columns(4).Caption = "修改日期"
Dgr_Sjll.Columns(5).Caption = "修改人"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -