📄 frm_addtime.frm
字号:
VERSION 5.00
Begin VB.Form UfrmAddTime
BorderStyle = 1 'Fixed Single
Caption = "客户洽谈时刻分析"
ClientHeight = 1980
ClientLeft = 45
ClientTop = 330
ClientWidth = 4620
ControlBox = 0 'False
Icon = "frm_AddTime.frx":0000
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1980
ScaleWidth = 4620
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "退出"
Height = 320
Left = 3240
TabIndex = 13
Top = 1320
Width = 855
End
Begin VB.CommandButton Command1
Caption = "添加"
Default = -1 'True
Height = 320
Left = 2280
TabIndex = 12
Top = 1320
Width = 855
End
Begin VB.TextBox Text6
Appearance = 0 'Flat
Height = 270
Left = 3000
TabIndex = 11
Top = 960
Width = 1095
End
Begin VB.TextBox Text5
Appearance = 0 'Flat
Height = 270
Left = 3000
TabIndex = 10
Top = 600
Width = 1095
End
Begin VB.TextBox Text4
Appearance = 0 'Flat
Height = 270
Left = 3000
TabIndex = 9
Top = 240
Width = 1095
End
Begin VB.TextBox Text3
Appearance = 0 'Flat
Height = 270
Left = 840
TabIndex = 8
Top = 960
Width = 1095
End
Begin VB.TextBox Text2
Appearance = 0 'Flat
Height = 270
Left = 840
TabIndex = 7
Top = 600
Width = 1095
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 270
Left = 840
TabIndex = 6
Top = 240
Width = 1095
End
Begin VB.Line Line1
Index = 3
X1 = 4440
X2 = 4440
Y1 = 120
Y2 = 1800
End
Begin VB.Line Line1
Index = 2
X1 = 120
X2 = 120
Y1 = 120
Y2 = 1800
End
Begin VB.Line Line1
Index = 1
X1 = 120
X2 = 4440
Y1 = 1800
Y2 = 1800
End
Begin VB.Line Line1
Index = 0
X1 = 120
X2 = 4440
Y1 = 120
Y2 = 120
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "分钟:"
Height = 180
Left = 2460
TabIndex = 5
Top = 1005
Width = 540
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "小时:"
Height = 180
Left = 2460
TabIndex = 4
Top = 600
Width = 540
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "日:"
Height = 180
Left = 2640
TabIndex = 3
Top = 240
Width = 360
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "月:"
Height = 180
Left = 480
TabIndex = 2
Top = 1005
Width = 360
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "年:"
Height = 180
Left = 480
TabIndex = 1
Top = 600
Width = 360
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "客户 :"
Height = 180
Left = 240
TabIndex = 0
Top = 240
Width = 630
End
End
Attribute VB_Name = "UfrmAddTime"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
'On Error Resume Next
If Text1.Text = "" And Text2.Text = "" And Text3.Text = "" And Text4.Text = "" And Text5.Text = "" And Text6.Text = "" Then
MsgBox ("你没有输入数据!"), vbExclamation
Exit Sub
End If
Dim Cn As New Connection
Dim Fbwt_Rs As New Recordset
Call ConnectDataBase
Cn.Open cnDataBase_GivePower
Cn.CursorLocation = adUseClient
Cn.Execute "insert into timefen(客户,年,月,日,小时,分钟) values ('" & Text1.Text & "','" & Text2.Text & "','" & Text3.Text & "','" & Text4.Text & "','" & Text5.Text & "','" & Text6.Text & "')"
Fbwt_Rs.Open "select * from timefen", Cn, adOpenStatic
Set UfrmTimeFenXi.DataGrid1.DataSource = Fbwt_Rs
MsgBox ("成功!"), vbInformation
Unload Me
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
'On Error Resume Next
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
Text2.Text = Year(Now)
Text3.Text = Month(Now)
Text4.Text = Day(Now)
Text5.Text = Hour(Now)
Text6.Text = Minute(Now)
End Sub
Private Sub Text3_LostFocus()
Dim i As Integer
i = Text3.Text
If i < 1 Or i > 12 Then
MsgBox ("月份数在1-12间!"), vbExclamation
Exit Sub
End If
End Sub
Private Sub Text4_LostFocus()
Dim i As Integer
Dim ii As Integer
i = Text3.Text
ii = Text4.Text
Select Case i
Case 1, 3, 5, 7, 8, 10, 12
If ii > 31 Or ii < 1 Then
MsgBox ("本月的天数在1--31天之间!"), vbExclamation
Exit Sub
End If
Case 2
If ii > 28 Or i < 1 Then
MsgBox ("本月的天数为28天"), vbExclamation
Exit Sub
End If
Case 4, 6, 9, 11
If ii > 30 Or i < 1 Then
MsgBox ("本月的天数在1--30天之间!"), vbExclamation
Exit Sub
End If
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -