?? phonerecord.frm
字號:
VERSION 5.00
Begin VB.Form PhoneRecords
Caption = "電話記錄"
ClientHeight = 7395
ClientLeft = 60
ClientTop = 345
ClientWidth = 7455
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
Moveable = 0 'False
ScaleHeight = 7395
ScaleWidth = 7455
StartUpPosition = 2 'CenterScreen
Begin VB.TextBox Text10
ForeColor = &H00FF0000&
Height = 420
Left = 1440
MaxLength = 50
TabIndex = 25
Top = 5520
Width = 5655
End
Begin VB.TextBox Text9
ForeColor = &H00FF0000&
Height = 345
Left = 4560
TabIndex = 23
Top = 1320
Width = 2535
End
Begin VB.ComboBox Combo1
ForeColor = &H00FF0000&
Height = 420
Left = 1320
TabIndex = 20
Top = 720
Width = 5775
End
Begin VB.CommandButton Command2
Caption = "關 閉"
Height = 375
Left = 5040
TabIndex = 19
Top = 6840
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "提 交"
Height = 375
Left = 1440
TabIndex = 18
Top = 6840
Width = 1215
End
Begin VB.TextBox Text8
ForeColor = &H00FF0000&
Height = 420
Left = 5640
TabIndex = 17
Top = 6120
Width = 1455
End
Begin VB.TextBox Text7
ForeColor = &H00FF0000&
Height = 420
Left = 1440
TabIndex = 15
Top = 6120
Width = 1815
End
Begin VB.TextBox Text6
Height = 3495
Left = 360
MaxLength = 240
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 13
Top = 1800
Width = 6735
End
Begin VB.TextBox Text5
Alignment = 2 'Center
ForeColor = &H00FF0000&
Height = 375
Left = 6240
TabIndex = 5
Top = 120
Width = 495
End
Begin VB.TextBox Text4
Alignment = 2 'Center
ForeColor = &H00FF0000&
Height = 375
Left = 5160
TabIndex = 4
Top = 120
Width = 495
End
Begin VB.TextBox Text3
Alignment = 2 'Center
ForeColor = &H00FF0000&
Height = 375
Left = 4080
TabIndex = 3
Top = 120
Width = 495
End
Begin VB.TextBox Text2
Alignment = 2 'Center
ForeColor = &H00FF0000&
Height = 375
Left = 3000
TabIndex = 2
Top = 120
Width = 495
End
Begin VB.TextBox Text1
Alignment = 2 'Center
ForeColor = &H00FF0000&
Height = 375
Left = 1320
TabIndex = 1
Top = 120
Width = 1095
End
Begin VB.Label Label13
Caption = "內容摘要"
Height = 255
Left = 360
TabIndex = 24
Top = 5640
Width = 975
End
Begin VB.Label Label12
Caption = "電話號碼"
Height = 255
Left = 3480
TabIndex = 22
Top = 1320
Width = 975
End
Begin VB.Label Label11
Caption = "(少于120字)"
ForeColor = &H00008000&
Height = 255
Left = 1320
TabIndex = 21
Top = 1320
Width = 1815
End
Begin VB.Label Label10
Caption = "值 班 員"
Height = 375
Left = 4560
TabIndex = 16
Top = 6240
Width = 1095
End
Begin VB.Label Label9
Caption = "來 電 人"
Height = 375
Left = 360
TabIndex = 14
Top = 6240
Width = 855
End
Begin VB.Label Label8
Caption = "電話內容"
Height = 375
Left = 240
TabIndex = 12
Top = 1320
Width = 975
End
Begin VB.Label Label7
Caption = "來電單位"
Height = 255
Left = 240
TabIndex = 11
Top = 840
Width = 975
End
Begin VB.Label Label6
Caption = "分"
Height = 375
Left = 6960
TabIndex = 10
Top = 240
Width = 375
End
Begin VB.Label Label5
Caption = "時"
Height = 375
Left = 5880
TabIndex = 9
Top = 240
Width = 255
End
Begin VB.Label Label4
Caption = "日"
Height = 375
Left = 4680
TabIndex = 8
Top = 240
Width = 375
End
Begin VB.Label Label3
Caption = "月"
Height = 375
Left = 3720
TabIndex = 7
Top = 240
Width = 255
End
Begin VB.Label Label2
Caption = "年"
Height = 375
Left = 2640
TabIndex = 6
Top = 240
Width = 255
End
Begin VB.Label Label1
Caption = "來電時間"
Height = 255
Left = 240
TabIndex = 0
Top = 240
Width = 975
End
End
Attribute VB_Name = "PhoneRecords"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
recordTime = Text1.Text + "-" + Text2.Text + "-" + Text3.Text + " " + Text4.Text + ":" + Text5.Text
If Len(recordTime) < 16 Then
rc = MsgBox("請輸入來電時間!", vbOKOnly + vbExclamation, "輸入數據不完整")
Text1.SetFocus
Exit Sub
End If
If Combo1.Text <> "" Then
Unit = Combo1.Text
Else
rc = MsgBox("請選擇來電單位", vbOKOnly + vbExclamation, "輸入數據不完整")
Combo1.SetFocus
Exit Sub
End If
If Text6.Text = "" Or Text7.Text = "" Or Text8.Text = "" Or Text9.Text = "" Or Text10.Text = "" Then
MsgBox "請在空格中填入數據!"
Exit Sub
End If
Content = Text6.Text
Contact = Text7.Text
Duty = Text8.Text
PhoneNum = Text9.Text
Atracts = Text10.Text
rc = SQLAllocStmt(hdbc, hstmt)
If rc = SQL_ERROR Then
MsgBox "數據庫連接失敗。", vbCritical + vbOKOnly, "SQL出錯"
Unload Form1
End
End If
SQLstmt = "INSERT INTO phonerecord VALUES ('" & Unit & "','" & _
recordTime & "','" & Content & "','" & Contact & "','" & _
Duty & "','" & PhoneNum & "','" & Atracts & "')"
rc = SQLExecDirect(hstmt, SQLstmt, SQL_NTS)
If rc <> SQL_ERROR Then
rc = MsgBox("以上數據已輸入數據庫中!", vbOKOnly + vbExclamation, "錄入成功")
Else: MsgBox "error", vbCritical, "unsuccess"
End If
rc = SQLFreeStmt(hstmt, SQL_DROP)
Combo1.Clear
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Combo1.SetFocus
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Text1.Text = Year(Date)
Text2.Text = Month(Date)
If Len(Text2.Text) < 2 Then Text2.Text = "0" + Text2.Text
Text3.Text = Day(Date)
If Len(Text3.Text) < 2 Then Text3.Text = "0" + Text3.Text
Text4.Text = Hour(Time)
If Len(Text4.Text) < 2 Then Text4.Text = "0" + Text4.Text
Text5.Text = Minute(Time)
If Len(Text5.Text) < 2 Then Text5.Text = "0" + Text5.Text
RD2 = String(50, 0)
rc = SQLAllocStmt(hdbc, hstmt)
If rc = SQL_ERROR Then
MsgBox "數據庫連接失敗。", vbCritical + vbOKOnly, "SQL出錯"
Unload Form1
End
End If
SQLstmt = "SELECT partaname FROM prorecord"
rc = SQLExecDirect(hstmt, SQLstmt, SQL_NTS)
Do While SQLFetch(hstmt) <> SQL_NO_DATA_FOUND
rc = SQLGetData(hstmt, 1, SQL_C_CHAR, RD2, Len(RD2), SQL_NULL_DATA)
Combo1.additem RD2
Loop
rc = SQLFreeStmt(hstmt, SQL_DROP)
End Sub
Private Sub Form_Unload(Cancel As Integer)
Form1.Enabled = True
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -