📄 frmadd.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomct2.ocx"
Begin VB.Form frmAdd
BorderStyle = 3 'Fixed Dialog
Caption = "添加通讯信息"
ClientHeight = 3975
ClientLeft = 45
ClientTop = 435
ClientWidth = 7695
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "frmAdd.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 3975
ScaleWidth = 7695
ShowInTaskbar = 0 'False
Begin VB.Frame Frame1
Height = 855
Left = 1440
TabIndex = 24
Top = 600
Width = 2175
Begin VB.OptionButton optMan
Caption = "男"
Height = 285
Left = 120
TabIndex = 2
Top = 360
Width = 615
End
Begin VB.OptionButton optWoman
Caption = "女"
Height = 285
Left = 1080
TabIndex = 3
Top = 360
Width = 615
End
End
Begin VB.TextBox txtID
BackColor = &H80000011&
Height = 405
Left = 1440
Locked = -1 'True
MaxLength = 30
TabIndex = 0
Top = 120
Width = 2175
End
Begin VB.CommandButton cmdReset
Caption = "重置(&R)"
Height = 495
Left = 4920
TabIndex = 11
Top = 3240
Width = 1215
End
Begin VB.TextBox txtUser
Height = 405
Left = 5400
MaxLength = 30
TabIndex = 1
Top = 120
Width = 2055
End
Begin VB.CommandButton cmdBack
Caption = "返回(&B)"
Height = 495
Left = 6240
TabIndex = 12
Top = 3240
Width = 1335
End
Begin VB.CommandButton cmdAdd
Caption = "添加(&A)"
Height = 495
Left = 3480
TabIndex = 10
Top = 3240
Width = 1215
End
Begin VB.TextBox txtEmail
Height = 405
Left = 5040
MaxLength = 30
TabIndex = 8
Top = 2040
Width = 2415
End
Begin VB.TextBox txtQQ
Height = 405
Left = 5040
MaxLength = 11
TabIndex = 7
Top = 1560
Width = 2415
End
Begin VB.TextBox txtMobile
Height = 405
Left = 5400
MaxLength = 11
TabIndex = 5
Top = 1080
Width = 2055
End
Begin VB.TextBox txtPhone
Height = 405
Left = 1440
MaxLength = 11
TabIndex = 6
Top = 2040
Width = 2175
End
Begin VB.TextBox txtZipCode
Height = 405
Left = 5400
MaxLength = 6
TabIndex = 4
Top = 600
Width = 2055
End
Begin VB.TextBox txtAddress
Height = 525
Left = 1440
MaxLength = 50
TabIndex = 9
Top = 2520
Width = 6135
End
Begin MSComCtl2.DTPicker dtpBirth
Height = 375
Left = 1440
TabIndex = 13
Top = 1560
Width = 2175
_ExtentX = 3836
_ExtentY = 661
_Version = 393216
Format = 25427969
CurrentDate = 39057
End
Begin VB.Label Label7
Caption = "编号:"
Height = 375
Left = 240
TabIndex = 23
Top = 120
Width = 975
End
Begin VB.Label Label10
Caption = "E-Mail:"
Height = 375
Left = 3840
TabIndex = 22
Top = 2040
Width = 1215
End
Begin VB.Label Label9
Caption = "QQ:"
Height = 375
Left = 3840
TabIndex = 21
Top = 1560
Width = 1095
End
Begin VB.Label Label8
Caption = "移动电话:"
Height = 375
Left = 3840
TabIndex = 20
Top = 1080
Width = 1455
End
Begin VB.Label Label6
Caption = "电话号码:"
Height = 375
Left = 120
TabIndex = 19
Top = 2040
Width = 1455
End
Begin VB.Label Label5
Caption = "邮政编码:"
Height = 375
Left = 3840
TabIndex = 18
Top = 600
Width = 1455
End
Begin VB.Label Label4
Caption = "通信地址:"
Height = 375
Left = 120
TabIndex = 17
Top = 2640
Width = 1455
End
Begin VB.Label Label3
Caption = "出生日期:"
Height = 375
Left = 120
TabIndex = 16
Top = 1560
Width = 1455
End
Begin VB.Label Label2
Caption = "性别:"
Height = 375
Left = 240
TabIndex = 15
Top = 840
Width = 975
End
Begin VB.Label Label1
Caption = "姓名:"
Height = 375
Left = 3840
TabIndex = 14
Top = 120
Width = 975
End
End
Attribute VB_Name = "frmAdd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdAdd_Click()
Dim strU$, strSex$, strBirth$, strAddress$
Dim strZip$, strPhone$, strMobile$
Dim strQQ$, strEmail$, strID$
strU = Trim(txtUser.Text)
If optMan.Value = True Then
strSex = "男"
Else
strSex = "女"
End If
strBirth = Format(dtpBirth.Value, "yyyy-mm-dd")
strAddress = Trim(txtAddress.Text)
strZip = Trim(txtZipCode.Text)
strPhone = Trim(txtPhone.Text)
strMobile = Trim(txtMobile.Text)
strQQ = Trim(txtQQ.Text)
strEmail = Trim(txtEmail.Text)
If strU = "" Or strSex = "" Or strBirth = "" Or strAddress = "" Or strZip = "" Or strPhone = "" Or strMobile = "" Or strQQ = "" Or strEmail = "" Then
MsgBox "信息未输入完全!", 48, "添加"
Exit Sub
End If
strSQL = "select max(pid) from person"
Set RS = conn.Execute(strSQL)
strID = Format(Val(Format(RS.Fields(0))) + 1)
txtID.Text = strID
strSQL = "insert into person values("
strSQL = strSQL + strID + ",'" + strU + "','" + strSex + "','"
strSQL = strSQL + strBirth + "','" + strAddress + "','" + strZip + "','" + strPhone + "','" + strMobile + "','" + strQQ + "','" + strEmail + "')"
conn.Execute strSQL
MsgBox "添加成功!", 48, "添加"
RS.Close
End Sub
Private Sub cmdBack_Click()
Unload frmAdd
End Sub
Private Sub cmdReset_Click()
txtUser.Text = ""
optMan.Value = True
dtpBirth.Value = Date
txtAddress.Text = ""
txtZipCode.Text = ""
txtPhone.Text = ""
txtMobile.Text = ""
txtQQ.Text = ""
txtEmail.Text = ""
txtUser.SetFocus
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -