📄 frmtdgl.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmTDGL
Caption = "团队管理"
ClientHeight = 4350
ClientLeft = 60
ClientTop = 450
ClientWidth = 7740
LinkTopic = "Form1"
LockControls = -1 'True
MDIChild = -1 'True
ScaleHeight = 4350
ScaleWidth = 7740
Begin VB.Frame Frame3
Height = 1095
Left = 2220
TabIndex = 11
Top = 3180
Width = 5475
Begin VB.CommandButton Command4
Caption = "修改"
Height = 435
Left = 1695
TabIndex = 15
Top = 345
Width = 1065
End
Begin VB.CommandButton Command3
Caption = "退出"
Height = 435
Left = 3900
TabIndex = 14
Top = 345
Width = 1065
End
Begin VB.CommandButton Command2
Caption = "删除"
Height = 435
Left = 2805
TabIndex = 13
Top = 345
Width = 1065
End
Begin VB.CommandButton Command1
Caption = "新增"
Height = 435
Left = 600
TabIndex = 5
Top = 345
Width = 1065
End
End
Begin VB.Frame Frame2
Height = 3135
Left = 2220
TabIndex = 6
Top = 60
Width = 5475
Begin VB.ComboBox TDZG
Height = 300
Left = 1380
TabIndex = 3
Top = 1845
Width = 3255
End
Begin VB.TextBox MEMO
Height = 300
Left = 1380
TabIndex = 4
Top = 2460
Width = 3255
End
Begin VB.TextBox TDRS
Height = 300
Left = 1380
TabIndex = 2
Top = 1230
Width = 3255
End
Begin VB.TextBox TDMC
Height = 300
Left = 1380
TabIndex = 1
Top = 615
Width = 3255
End
Begin VB.Label label5
Caption = "团队主管"
Height = 375
Left = 240
TabIndex = 12
Top = 1895
Width = 1575
End
Begin VB.Label Label4
Caption = "备 注"
Height = 375
Left = 240
TabIndex = 10
Top = 2505
Width = 1575
End
Begin VB.Label Label3
Caption = "团队人数"
Height = 375
Left = 240
TabIndex = 9
Top = 1285
Width = 1575
End
Begin VB.Label Label2
Caption = "团队名称"
Height = 375
Left = 240
TabIndex = 8
Top = 675
Width = 1575
End
End
Begin VB.Frame Frame1
Height = 4215
Left = 120
TabIndex = 0
Top = 60
Width = 2055
Begin MSComctlLib.ListView LSTTD
Height = 3915
Left = 60
TabIndex = 7
Top = 180
Width = 1935
_ExtentX = 3413
_ExtentY = 6906
View = 3
LabelEdit = 1
LabelWrap = -1 'True
HideSelection = -1 'True
FullRowSelect = -1 'True
_Version = 393217
Icons = "ImageList1"
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 0
End
Begin MSComctlLib.ImageList ImageList1
Left = 0
Top = 0
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 32
ImageHeight = 32
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 12
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmTDGL.frx":0000
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmTDGL.frx":1D0C
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmTDGL.frx":2030
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmTDGL.frx":2F0C
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmTDGL.frx":3DE8
Key = ""
EndProperty
BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmTDGL.frx":410C
Key = ""
EndProperty
BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmTDGL.frx":4430
Key = ""
EndProperty
BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmTDGL.frx":4754
Key = ""
EndProperty
BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmTDGL.frx":4A78
Key = ""
EndProperty
BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmTDGL.frx":4D9C
Key = ""
EndProperty
BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmTDGL.frx":50C0
Key = ""
EndProperty
BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmTDGL.frx":53E4
Key = ""
EndProperty
EndProperty
End
End
End
Attribute VB_Name = "frmTDGL"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim id As Long
Private Sub Command1_Click()
If Trim(TDMC) = "" Or Trim(TDRS) = "" Then
MsgBox "团队名称或团队人数不能为空!!", vbInformation, "系统提示"
Exit Sub
End If
If Trim(TDZG) = "" Then
MsgBox "团队主管不能为空!!", vbInformation, "系统提示"
Exit Sub
End If
Dim strsql As String
Dim rs As New ADODB.Recordset
Set rs = New ADODB.Recordset
strsql = "select * from tdgl where tdmc='" & Trim(TDMC) & "'"
rs.Open strsql, gCnn, adOpenStatic, adLockReadOnly
If Not rs.EOF Then
MsgBox "存在相同的团队名,不能添加!!", vbInformation, "系统提示"
Exit Sub
End If
strsql = "insert into TDGL(TDMC,TDrs,TDZG,TDZGGH,MEMO)values('" & Trim(TDMC) & "','" & Trim(TDRS) & "','" & Right(Trim(TDZG), Len(Trim(TDZG)) - 5) & "','" & Left(Trim(TDZG), 4) & "','" & Trim(MEMO) & "')"
gCnn.Execute strsql
TDMC = ""
TDRS = ""
TDZG = ""
MEMO = ""
Call Form_Load
Command4.Enabled = False
Command2.Enabled = False
End Sub
Private Sub Command2_Click()
gCnn.Execute "delete from tdgl where id=" & id
TDMC = ""
TDRS = ""
TDZG = ""
MEMO = ""
Call Form_Load
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Command4_Click()
Dim strsql As String
strsql = "update tdgl set tdmc='" & TDMC & "',tdrs='" & TDRS & "',TDZG='" & Right(Trim(TDZG), Len(Trim(TDZG)) - 5) & "',tdzggh='" & Left(Trim(TDZG), 4) & "',MEMO='" & MEMO & "' where id=" & id
gCnn.Execute strsql
TDMC = ""
TDRS = ""
TDZG = ""
MEMO = ""
Command4.Enabled = False
Call Form_Load
End Sub
Private Sub Form_Load()
If Me.WindowState = 0 Then Me.Move 0, 0, 7860, 4860
Dim msg As String
Dim rs As New ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "select id,tdmc as 团队名称 from tdGL order by id", gCnn, adOpenStatic, adLockReadOnly
msg = ShowListView(LSTTD, rs, False, "0,2000")
If rs.State = 1 Then rs.Close
rs.Open "select 工号,姓名 from viewygxx order by 工号", gCnn, adOpenStatic, adLockReadOnly
TDZG.Clear
TDZG = "0000-其他"
For i = 0 To rs.RecordCount - 1
TDZG.AddItem rs(0) & "-" & rs(1)
rs.MoveNext
Next
Command4.Enabled = False
Command2.Enabled = False
End Sub
Private Sub LSTTD_ItemClick(ByVal Item As MSComctlLib.ListItem)
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "select * from TDGL where id=" & Item, gCnn, adOpenStatic, adLockReadOnly
If Not rs.EOF Then
TDMC = rs("tdmc")
TDRS = rs("tdrs")
TDZG = rs("tdzggh") & "-" & rs("tdzg")
MEMO = rs("memo")
Command4.Enabled = True
Command2.Enabled = True
id = Item
End If
End Sub
Private Sub MEMO_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then SendKeys "{Tab}"
End Sub
Private Sub TDMC_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then SendKeys "{Tab}"
End Sub
Private Sub TDRS_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then SendKeys "{Tab}"
End Sub
Private Sub TDZG_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Dim srtYGGH As String
'===========查找员工编号
Dim hh As Long
For hh = 1 To Len(TDZG.Text)
srtYGGH = Left(TDZG, hh)
If Right(srtYGGH, 1) = "-" Then
srtYGGH = Left(srtYGGH, Len(srtYGGH) - 1)
Exit For
End If
Next
'===========查找员工编号
TDZG.Text = CheckGhLy(srtYGGH, TDZG)
SendKeys "{Tab}"
End If
End Sub
Private Function CheckGhLy(strTemp As String, ComboxTemp As ComboBox) As String
Dim i, j As Integer
Dim sTemp As String
If strTemp = "" Then
CheckGhLy = "0000-其他"
Exit Function
End If
strTemp = Trim(strTemp)
If ComboxTemp.ListCount <= 0 Then Exit Function
CheckGhLy = ""
For i = 0 To ComboxTemp.ListCount
' If Left(ComboxTemp.List(i), 4) = strTemp Then
For j = 1 To Len(ComboxTemp.List(i)) - 1
sTemp = Mid(ComboxTemp.List(i), j, 1)
If sTemp = "-" Then
If Left(ComboxTemp.List(i), j - 1) = strTemp Then
CheckGhLy = Mid(ComboxTemp.List(i), j + 1, 10)
CheckGhLy = ComboxTemp.List(i)
Exit Function
End If
End If
Next j
Next i
If CheckGhLy = "" Then
MsgBox "没有此员工,请核对!", vbInformation, "系统提示"
CheckGhLy = "0000-其他"
End If
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -