📄 局方联系人.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form Frmlxr
BorderStyle = 1 'Fixed Single
Caption = "局方联系人"
ClientHeight = 3900
ClientLeft = 45
ClientTop = 330
ClientWidth = 8670
Icon = "局方联系人.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
ScaleHeight = 3900
ScaleWidth = 8670
Visible = 0 'False
Begin VB.PictureBox Pic2
BackColor = &H00FFC0C0&
Height = 3855
Left = 3720
ScaleHeight = 3795
ScaleWidth = 4875
TabIndex = 2
Top = 0
Width = 4935
Begin VB.CommandButton Cmdadd
Caption = "添加"
Height = 375
Left = 3720
TabIndex = 20
Top = 120
Width = 585
End
Begin VB.CommandButton Cmddel
Caption = "删除"
Height = 375
Left = 3720
TabIndex = 19
Top = 1160
Width = 585
End
Begin VB.CommandButton Cmdupdate
Caption = "修改"
Height = 375
Left = 3720
TabIndex = 18
Top = 2200
Width = 585
End
Begin VB.CommandButton Cmdexit
Caption = "退出"
Height = 375
Left = 3720
TabIndex = 17
Top = 3240
Width = 585
End
Begin VB.Frame Frame1
BackColor = &H00FFC0C0&
Caption = "详细信息"
Height = 3735
Left = 120
TabIndex = 3
Top = 0
Width = 3495
Begin VB.TextBox Txtdha
Height = 375
Left = 960
TabIndex = 9
Top = 720
Width = 2415
End
Begin VB.TextBox Txtdhb
Height = 375
Left = 960
TabIndex = 8
Top = 1200
Width = 2415
End
Begin VB.TextBox Txtyb
Height = 375
Left = 960
TabIndex = 7
Top = 1680
Width = 2415
End
Begin VB.TextBox Txtdz
Height = 1335
Left = 960
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 6
Top = 2280
Width = 2415
End
Begin VB.TextBox Txtlxr
Height = 375
Left = 960
TabIndex = 5
Top = 240
Width = 2415
End
Begin VB.CommandButton Cmdqk
Caption = "清空"
Height = 375
Left = 120
TabIndex = 4
Top = 2760
Width = 615
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "电话A"
Height = 375
Left = 120
TabIndex = 16
Top = 840
Width = 855
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "电话B"
Height = 375
Left = 120
TabIndex = 15
Top = 1320
Width = 855
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "邮政编码"
Height = 375
Left = 120
TabIndex = 14
Top = 1800
Width = 1095
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "通讯地址"
Height = 255
Left = 120
TabIndex = 13
Top = 2400
Width = 855
End
Begin VB.Label Lab
Caption = "lab"
Height = 375
Left = 600
TabIndex = 12
Top = 600
Width = 255
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "联系人"
Height = 375
Left = 120
TabIndex = 11
Top = 240
Width = 735
End
Begin VB.Label Lab2
Caption = "Label6"
Height = 255
Left = 120
TabIndex = 10
Top = 3240
Width = 855
End
End
End
Begin VB.PictureBox Pic1
Height = 2055
Left = 3120
ScaleHeight = 1995
ScaleWidth = 75
TabIndex = 1
Top = 480
Width = 135
End
Begin MSComctlLib.ImageList ImageList1
Left = 2520
Top = 360
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 4
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "局方联系人.frx":014A
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "局方联系人.frx":0464
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "局方联系人.frx":077E
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "局方联系人.frx":0A98
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.TreeView TVw
Height = 3855
Left = 0
TabIndex = 0
Top = 0
Width = 3615
_ExtentX = 6376
_ExtentY = 6800
_Version = 393217
LabelEdit = 1
LineStyle = 1
Style = 7
ImageList = "ImageList1"
Appearance = 1
End
End
Attribute VB_Name = "Frmlxr"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rsls As Recordset
Dim Idbj As Integer
'添加控件拖动
Private Const pic1width As Integer = 40 'pic1宽度
Private currSplitPosX As Long '鼠标移动值X
Dim top_ding As Integer '窗体内控件离顶距离
Dim SPLT_COLOUR As Long '背境色
Private Sub Cmdadd_Click()
On Error GoTo err
Dim dha, dhb, yb, dz, lxr As String
If MsgBox("确认要添加吗? ", vbQuestion + vbYesNo) = vbYes Then
If Len(Trim(Txtdha.Text)) > 20 Then
MsgBox "电话A内容超过20位", vbExclamation, "错误提示"
Exit Sub
End If
If Len(Trim(Txtdhb.Text)) > 20 Then
MsgBox "电话B内容超过20位", vbExclamation, "错误提示"
Exit Sub
End If
If Len(Trim(Txtyb.Text)) > 10 Then
MsgBox "邮政编码内容超过10位", vbExclamation, "错误提示"
Exit Sub
End If
MousePointer = vbHourglass
If Txtdha.Text = "" Then
dha = ""
Else
dha = Trim(Txtdha.Text)
End If
If Txtdhb.Text = "" Then
dhb = ""
Else
dhb = Trim(Txtdhb.Text)
End If
If Txtyb.Text = "" Then
yb = ""
Else
yb = Trim(Txtyb.Text)
End If
If Txtdz.Text = "" Then
dz = ""
Else
dz = Trim(Txtdz.Text)
End If
If Txtlxr.Text = "" Then
lxr = ""
Else
lxr = Trim(Txtlxr.Text)
End If
Dim rsch As Recordset
'Set rsch = db.OpenRecordset("select * from jflx where dha='" & dha & "' and dhb='" & dhb _
& "' and yb='" & yb & "' and address='" & dz & "' and lxr='" & lxr & "'")
Set rsch = db.OpenRecordset("select * from jflx where lxr='" & lxr & "'")
If rsch.RecordCount > 0 Then
MousePointer = vbDefault
MsgBox "记录重复!", vbExclamation, "信息"
Exit Sub
End If
rsch.Close
Dim rs As Recordset
Set rs = db.OpenRecordset("select * from jflx")
If rs.RecordCount > 0 Then
rs.MoveLast
End If
rs.AddNew
rs.Fields!jfxxid = Lab2.Caption
rs.Fields!lxr = lxr
rs.Fields!dha = dha
rs.Fields!dhb = dhb
rs.Fields!yb = yb
rs.Fields!address = dz
rs.Update
rs.MoveLast
lxr = lxr & "@" & rs.Fields!id
MousePointer = vbDefault
rs.Close
Dim str2 As String
str2 = TVw.Nodes(TVw.SelectedItem.Index).Key
Dim ladd As String
ladd = str2 & "l"
Dim xnod As Node
Set xnod = TVw.Nodes.Add(str2, , ladd, lxr, 4)
MsgBox "添加记录成功", vbQuestion, "信息"
End If
Exit Sub
err:
MousePointer = vbDefault
MsgBox err.Description, vbExclamation, "错误提示"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -