📄 form3.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "MSHFLXGD.OCX"
Begin VB.Form Form3
BackColor = &H00C0C0C0&
BorderStyle = 1 'Fixed Single
Caption = "浏览客户信息"
ClientHeight = 6255
ClientLeft = 45
ClientTop = 330
ClientWidth = 11910
Icon = "Form3.frx":0000
LinkTopic = "Form3"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 6255
ScaleWidth = 11910
Begin VB.CommandButton Command1
Caption = "添加客户"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 120
MaskColor = &H00000000&
TabIndex = 6
Top = 5520
Width = 1215
End
Begin VB.Frame Frame3
Height = 945
Left = 0
TabIndex = 3
Top = 0
Width = 3045
Begin MSComctlLib.Toolbar Toolbar1
Height = 525
Left = 120
TabIndex = 4
Top = 120
Width = 2895
_ExtentX = 5106
_ExtentY = 926
ButtonWidth = 820
ButtonHeight = 926
Style = 1
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 7
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "查找"
Object.Tag = "find"
ImageKey = "find"
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "修改"
Key = "modi"
Object.Tag = "modi"
ImageKey = "modi"
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "删除"
Object.Tag = "del"
ImageKey = "del"
EndProperty
BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "打印"
Object.Tag = "print"
ImageKey = "print"
Style = 5
BeginProperty ButtonMenus {66833FEC-8583-11D1-B16A-00C0F0283628}
NumButtonMenus = 2
BeginProperty ButtonMenu1 {66833FEE-8583-11D1-B16A-00C0F0283628}
Key = "dang"
Text = "打印当前记录"
EndProperty
BeginProperty ButtonMenu2 {66833FEE-8583-11D1-B16A-00C0F0283628}
Key = "all"
Text = "打印全部记录"
EndProperty
EndProperty
EndProperty
EndProperty
End
End
Begin VB.Frame Frame2
BackColor = &H80000013&
Height = 6135
Left = 3000
TabIndex = 2
Top = 0
Width = 8655
Begin MSHierarchicalFlexGridLib.MSHFlexGrid MSF1
Height = 6015
Left = 0
TabIndex = 5
Top = 120
Width = 8655
_ExtentX = 15266
_ExtentY = 10610
_Version = 393216
BackColor = -2147483624
BackColorSel = 16777215
ForeColorSel = 255
BackColorBkg = -2147483624
GridColor = 12632256
GridColorFixed = 4210752
SelectionMode = 1
AllowUserResizing= 3
_NumberOfBands = 1
_Band(0).Cols = 2
End
End
Begin VB.Frame Frame1
Caption = "浏览数据"
Height = 5175
Left = 0
TabIndex = 0
Top = 960
Width = 3015
Begin VB.CommandButton Command2
Caption = "新增用户"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 1440
TabIndex = 7
Top = 4560
Width = 1215
End
Begin MSComctlLib.TreeView TreeView1
Height = 3975
Left = 120
TabIndex = 1
Top = 240
Width = 2775
_ExtentX = 4895
_ExtentY = 7011
_Version = 393217
HideSelection = 0 'False
LineStyle = 1
Style = 7
FullRowSelect = -1 'True
HotTracking = -1 'True
BorderStyle = 1
Appearance = 1
End
End
End
Attribute VB_Name = "Form3"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public printstr As String
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Public Sub showtitle()
MSF1.Clear
Dim i As Integer
With MSF1
.Cols = 14
.TextMatrix(0, 1) = "学号"
.TextMatrix(0, 2) = "姓名"
.TextMatrix(0, 3) = "性别"
.TextMatrix(0, 4) = "年级"
.TextMatrix(0, 5) = "班级"
.TextMatrix(0, 6) = "专业"
.TextMatrix(0, 7) = "年制"
.TextMatrix(0, 8) = "出生年月"
.TextMatrix(0, 9) = "家庭住址"
.TextMatrix(0, 10) = "邮政编码"
.TextMatrix(0, 11) = "联系电话"
.TextMatrix(0, 12) = "入学时间"
.TextMatrix(0, 13) = "备注"
.ColWidth(0) = 200
.ColWidth(1) = 500
.ColWidth(2) = 700
.ColWidth(3) = 500
.ColWidth(4) = 1000
.ColWidth(5) = 800
.ColWidth(6) = 700
.ColWidth(7) = 800
.ColWidth(8) = 800
.ColWidth(9) = 3000
.ColWidth(10) = 800
.ColWidth(11) = 1000
.ColWidth(12) = 800
.ColWidth(13) = 6000
.FixedRows = 1
For i = 1 To 13
.ColAlignment(i) = 0
Next i
.FillStyle = flexFillSingle
.Col = 0
.Row = 0
.RowSel = 1
.ColSel = .Cols - 1
.CellAlignment = 4
.Row = 1
End With
End Sub
Private Sub Command1_Click()
Form1.Show
End Sub
Private Sub Command2_Click()
frmuser1.Show
End Sub
Private Sub Form_Activate()
If find = True Then
Form4.ZOrder
End If
If find = True Then
Exit Sub
ElseIf modi = True Then
showdata
' TreeView1_DblClick
modi = False
Else
tree
End If
End Sub
Public Sub showdata()
Dim j As Integer
Dim i As Integer
Dim mrc As ADODB.Recordset
Set mrc = New ADODB.Recordset
Set mrc = ExecuteSQL(txtsql)
If mrc.EOF = False Then
mrc.MoveFirst
With MSF1
.Rows = 50
.Row = 1
Do While Not mrc.EOF
.Rows = .Rows + 1
For i = 1 To mrc.Fields.Count
.TextMatrix(.Row, i) = mrc.Fields(i - 1)
Next i
.Row = .Row + 1
mrc.MoveNext
Loop
End With
Else
If find = True Then
Form3.Hide
Form4.Show
zzz = MsgBox("对不起,没有此学生的档案记录!", vbOKOnly, "查询")
Form4.ZOrder (0)
Form4.Text1(0).SetFocus
End If
End If
Set mrc = Nothing
End Sub
Private Sub Form_Unload(Cancel As Integer)
If find = True Then
find = False
Form4.Text1(0).SetFocus
End If
End Sub
Public Sub tree()
TreeView1.Nodes.Clear
Dim nodex As Node
Dim mrc As ADODB.Recordset
Dim mrc1 As ADODB.Recordset
Dim str As String
Dim a As String
a = "年级"
'TreeView1.LineStyle = tvwRootLines
str = "select distinct 年级 from class order by 年级"
Set mrc = ExecuteSQL(str)
str = "select distinct 年级,班级 from class order by 年级,班级"
Set mrc1 = ExecuteSQL(str)
mrc.MoveFirst
Do Until mrc.EOF
mrc1.MoveFirst
Set nodex = TreeView1.Nodes.Add(, , a, mrc.Fields(0), 1, 1)
Do While Not mrc1.EOF
If mrc1.Fields(0) = mrc.Fields(0) Then
Set nodex = TreeView1.Nodes.Add(a, tvwChild, , mrc1.Fields(1), 2, 2)
End If
mrc1.MoveNext
Loop
a = a & "1"
mrc.MoveNext
Loop
mrc1.Close
mrc.Close
Set mrc = Nothing
Set mrc1 = Nothing
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Tag
Case "find"
Form4.Show
Case "modi"
If Me.MSF1.TextMatrix(MSF1.Row, 1) = "" Then
sssss = MsgBox("你还没有选择记录!", vbOKOnly + vbExclamation, "警告")
Exit Sub
Else
qxstr = Executeqx(2)
If qxstr = "readonly" Then
ss = MsgBox("对不起,你是只读用户不能修改记录,请与管理员联系!", vbInformation + vbOKOnly, " 警告")
Exit Sub
End If
modi = True
Form1.Show
Form1.ZOrder 0
End If
Case "del"
Dim mrc As ADODB.Recordset
Dim intcount As Integer
If Me.MSF1.TextMatrix(MSF1.Row, 1) = "" Then
sssss = MsgBox("你还没有选择记录!", vbOKOnly + vbExclamation, "警告")
Else
If qxstr = "readonly" Then
ss = MsgBox("对不起,你是只读用户不能删除记录,请与管理员联系!", vbInformation + vbOKOnly, " 警告")
Exit Sub
End If
If MsgBox("确定要删除公司名称为 " & Me.MSF1.TextMatrix(MSF1.Row, 1) & " 的记录吗?" & vbOKCancel + vbExclamation, "警告") = vbOK Then
intcount = Me.MSF1.Row
txtsql = "delete * from custom where 公司名称='" & Me.MSF1.TextMatrix(MSF1.Row, 1) & "'"
Set mrc = ExecuteSQL(txtsql)
TreeView1_DblClick
End If
End If
' Case "print"
' Form6.Show
' Form6.ZOrder 0
End Select
End Sub
Private Sub TreeView1_DblClick()
On Error GoTo ss
If TreeView1.SelectedItem.Index = 0 Then
MSF1.Clear
Exit Sub
End If
txtsql = TreeView1.Nodes.Item(TreeView1.SelectedItem.Index)
txtsql = "select custom.公司名称, custom.公司地址, custom.部门名称, custom.负责人, custom.电话, custom.传真, custom.邮箱, custom.网址, custom.公司主营, custom.资料渠道, custom.资料查询者, custom.初访时间,custom.初访人,custom.制图软件,custom.设计电脑台数,custom.设计人数,custom.回访时间,custom.回访人,custom.试用时间,custom.采购时间,custom.点/台数,custom.版本,custom.备注 from custom where custom.公司名称='" & txtsql & "' or custom.公司地址'" & txtsql & "' custom.资料查询者='" & txtsql & "' or custom.初访人='" & txtsql & "' or custom.回访人='" & txtsql & "' order by custom.公司名称 desc "
printstr = txtsql
Me.Caption = "浏览客户档案"
Me.showtitle
Me.showdata
Exit Sub
ss:
MSF1.Clear
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -