📄 form6.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form Form6
Caption = "Form6"
ClientHeight = 5805
ClientLeft = 60
ClientTop = 345
ClientWidth = 8130
LinkTopic = "Form6"
ScaleHeight = 5805
ScaleWidth = 8130
StartUpPosition = 3 '窗口缺省
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 2520
Top = 2040
Width = 1695
_ExtentX = 2990
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=D:\data\mydb.mdb"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=D:\data\mydb.mdb"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
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 Command4
Caption = "退出"
Height = 375
Left = 3000
TabIndex = 12
Top = 5280
Width = 1095
End
Begin VB.CommandButton Command3
Caption = "确定"
Height = 375
Left = 1080
TabIndex = 11
Top = 5280
Width = 1095
End
Begin VB.ComboBox Combo2
Height = 300
ItemData = "Form6.frx":0000
Left = 2040
List = "Form6.frx":0010
TabIndex = 10
Top = 240
Width = 975
End
Begin VB.ListBox List2
Height = 2040
Left = 3720
TabIndex = 9
Top = 2760
Width = 1935
End
Begin VB.CommandButton Command2
Caption = "<<"
Height = 495
Left = 2520
TabIndex = 8
Top = 4080
Width = 975
End
Begin VB.CommandButton Command1
Caption = ">>"
Height = 495
Left = 2520
TabIndex = 7
Top = 3120
Width = 975
End
Begin VB.ListBox List1
Height = 2040
ItemData = "Form6.frx":0023
Left = 240
List = "Form6.frx":003C
TabIndex = 6
Top = 2760
Width = 1935
End
Begin VB.CheckBox Check1
Caption = "组合条件"
Height = 375
Left = 1800
TabIndex = 5
Top = 720
Width = 1455
End
Begin VB.TextBox Text2
Height = 375
Left = 3360
TabIndex = 4
Top = 1200
Width = 1695
End
Begin VB.ComboBox Combo4
Height = 300
ItemData = "Form6.frx":0084
Left = 2160
List = "Form6.frx":0094
TabIndex = 3
Top = 1200
Width = 975
End
Begin VB.ComboBox Combo3
Height = 300
ItemData = "Form6.frx":00A7
Left = 240
List = "Form6.frx":00C0
TabIndex = 2
Top = 1200
Width = 1695
End
Begin VB.TextBox Text1
Height = 375
Left = 3360
TabIndex = 1
Top = 240
Width = 1695
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "Form6.frx":0108
Left = 240
List = "Form6.frx":0121
TabIndex = 0
Top = 240
Width = 1695
End
End
Attribute VB_Name = "Form6"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub DataCombo1_Click(Area As Integer)
End Sub
Private Sub Check1_Click()
If Check1.Value = 1 Then
Combo3.Enabled = True
Combo4.Enabled = True
Text2.Enabled = True
Else
Combo3.Enabled = False
Combo4.Enabled = False
Text2.Enabled = False
End If
End Sub
Private Sub Command1_Click()
If List1.ListIndex <> -1 Then
List2.AddItem List1.Text
List1.RemoveItem List1.ListIndex
End If
End Sub
Private Sub Command2_Click()
If List2.ListIndex <> -1 Then
List1.AddItem List2.Text
List2.RemoveItem List2.ListIndex
End If
End Sub
Private Sub Command3_Click()
Dim i As Integer
Dim lists As String
If Text1 = " " Then
MsgBox "输入的查询条件不足!请正确输入", , "提示"
Else
lists = List2.List(0)
For i = 1 To List2.ListCount - 1
lists = lists & " , " & List2.List(i)
Next i
Adodc1.RecordSource = "select" & Space(1) & lists & Space(1) & "from room,cleaner where" & Space(1) & Combo1.Text & Combo2.Text & Space(1) & "'" & Text1.Text & "'"
Adodc1.Recordset.Refresh
If Check1.Value = 1 Then
Dim db As Database, sql As String
Set db = OpenDatabase("d:\data\mydb.mdb")
On Error Resume Next
sql = "select " & Space(1) & lists & Space(1) & " into temp from room where " & Combo1.Text & Combo2.Text & "'" & Text1.Text & " ' "
db.Execute "drop table temp;"
db.Execute sql
Adodc1.RecordSource = "select " & Space(1) & lists & Space(1) & " from temp where " & Combo3.Text & Combo4.Text & "'" & Text2.Text & " '"
Adodc1.Refresh
db.Close
End If
End If
If Adodc1.Recordset.EOF Then
MsgBox "查无此人!", , "提示"
Adodc1.RecordSource = "学生情况"
Adodc1.Refresh
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -