📄 changgroup.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form changgroup
BorderStyle = 1 'Fixed Single
Caption = "修改联系组"
ClientHeight = 2790
ClientLeft = 3825
ClientTop = 4260
ClientWidth = 3765
LinkTopic = "Form2"
MaxButton = 0 'False
ScaleHeight = 2790
ScaleWidth = 3765
Begin VB.ComboBox Combo3
DataSource = "Adodc2"
Height = 300
Left = 1440
TabIndex = 8
Text = "Combo3"
Top = 4320
Width = 1455
End
Begin MSAdodcLib.Adodc Adodc2
Height = 330
Left = 1080
Top = 4800
Width = 2055
_ExtentX = 3625
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=txlxt;Data Source=."
OLEDBString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=txlxt;Data Source=."
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = "sa"
Password = ""
RecordSource = "PersonlInfo"
Caption = "Adodc2"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.ComboBox Combo2
DataSource = "Adodc1"
Height = 300
Left = 1440
TabIndex = 7
Text = "Combo2"
Top = 3720
Visible = 0 'False
Width = 1695
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 1320
Top = 3120
Visible = 0 'False
Width = 1935
_ExtentX = 3413
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=txlxt;Data Source=."
OLEDBString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=txlxt;Data Source=."
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = "sa"
Password = ""
RecordSource = "Grouping"
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.CommandButton Command3
Caption = "关闭"
Height = 375
Left = 2040
TabIndex = 6
Top = 1800
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "确定修改"
Height = 375
Left = 480
TabIndex = 5
Top = 1800
Width = 1335
End
Begin VB.TextBox Text1
Height = 270
Left = 2040
TabIndex = 4
Text = "Text1"
Top = 1320
Width = 1335
End
Begin VB.ComboBox Combo1
Height = 300
Left = 2040
Style = 2 'Dropdown List
TabIndex = 2
Top = 840
Width = 1335
End
Begin VB.Label Label3
Caption = "输入修改后的名字"
Height = 255
Left = 480
TabIndex = 3
Top = 1320
Width = 1575
End
Begin VB.Label Label2
Caption = "要修改的联系组名"
Height = 255
Left = 480
TabIndex = 1
Top = 840
Width = 1575
End
Begin VB.Label Label1
Caption = "修改联系组"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1200
TabIndex = 0
Top = 240
Width = 1215
End
End
Attribute VB_Name = "changgroup"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If Text1.Text = "" Then
MsgBox "请输入联系人姓名!", vbOKOnly + vbExclamation, "修改联系组"
Exit Sub
End If
If Combo1.Text = "默认" Then
MsgBox "默认组不能修改!!!", vbOKOnly + vbExclamation, "修改联系组"
Exit Sub
End If
Adodc1.Recordset.MoveFirst
While Not Adodc1.Recordset.EOF '判断联系组
If Adodc1.Recordset.Fields("Group_Name") = Trim(Text1.Text) Then
MsgBox "对不起该组名已经存在,请重新输入!", vbOKOnly + vbExclamation, "修改联系组"
Text1.Text = ""
Exit Sub
Else
Adodc1.Recordset.MoveNext
End If
Wend
Adodc1.Recordset.MoveFirst
While Not Adodc1.Recordset.EOF '判断联系组
If Adodc1.Recordset.Fields("Group_Name") = Trim(Combo1.Text) Then
Adodc1.Recordset.Fields("Group_Name") = Trim(Text1.Text)
Adodc2.CommandType = adCmdText
Adodc2.RecordSource = "select * from PersonlInfo where Group_Name=" + "'" & Trim(Combo1.Text) & "'"
Adodc2.Refresh
If Adodc2.Recordset.RecordCount = 0 Then
MsgBox "修改成功!", vbOKOnly + vbExclamation, "修改联系组"
Combo1.Clear '初始化
Adodc1.Recordset.Update
Adodc1.RecordSource = "select * from Grouping"
Adodc1.Refresh '刷新分组
Adodc1.Recordset.MoveFirst
While Not Adodc1.Recordset.EOF
Combo1.AddItem Trim(Adodc1.Recordset.Fields(1).Value)
Adodc1.Recordset.MoveNext
Wend
Combo1.ListIndex = 0
Text1.Text = ""
Exit Sub
Else '记录不为空
Adodc2.Recordset.MoveFirst
While Not Adodc2.Recordset.EOF
Adodc2.Recordset.Fields("Group_Name").Value = Trim(Text1.Text)
Adodc2.Recordset.MoveNext
Wend
MsgBox "修改成功!", vbOKOnly + vbExclamation, "修改联系组"
Combo1.Clear '初始化
Adodc1.Recordset.Update
Adodc1.RecordSource = "select * from Grouping"
Adodc1.Refresh '刷新分组
Adodc1.Recordset.MoveFirst
While Not Adodc1.Recordset.EOF
Combo1.AddItem Trim(Adodc1.Recordset.Fields(1).Value)
Adodc1.Recordset.MoveNext
Wend
Combo1.ListIndex = 0
Text1.Text = ""
Exit Sub
End If
End If
Adodc1.Recordset.MoveNext
Wend
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Load()
Text1.Text = ""
Adodc1.CommandType = adCmdText
Adodc1.Recordset.MoveFirst
While Not Adodc1.Recordset.EOF
Combo1.AddItem Trim(Adodc1.Recordset.Fields(1).Value)
Adodc1.Recordset.MoveNext
Wend
Combo1.ListIndex = 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -