📄 querystud.frm
字号:
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column10
DataField = "家长姓名"
Caption = "家长姓名"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column11
DataField = "联系电话"
Caption = "联系电话"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column12
DataField = "中考成绩"
Caption = "中考成绩"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column13
DataField = "家庭住址"
Caption = "家庭住址"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column14
DataField = "备注"
Caption = "备注"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column15
DataField = "照片"
Caption = "照片"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
ColumnWidth = 1365.165
EndProperty
BeginProperty Column01
ColumnWidth = 1365.165
EndProperty
BeginProperty Column02
ColumnWidth = 645.165
EndProperty
BeginProperty Column03
ColumnWidth = 915.024
EndProperty
BeginProperty Column04
ColumnWidth = 734.74
EndProperty
BeginProperty Column05
ColumnWidth = 2085.166
EndProperty
BeginProperty Column06
ColumnWidth = 2085.166
EndProperty
BeginProperty Column07
ColumnWidth = 1365.165
EndProperty
BeginProperty Column08
ColumnWidth = 1365.165
EndProperty
BeginProperty Column09
ColumnWidth = 1904.882
EndProperty
BeginProperty Column10
ColumnWidth = 1365.165
EndProperty
BeginProperty Column11
ColumnWidth = 1904.882
EndProperty
BeginProperty Column12
ColumnWidth = 824.882
EndProperty
BeginProperty Column13
ColumnWidth = 2085.166
EndProperty
BeginProperty Column14
ColumnWidth = 2085.166
EndProperty
BeginProperty Column15
ColumnWidth = 2085.166
EndProperty
EndProperty
End
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = "F:\schoolgroup\school.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 615
Left = 360
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "student"
Top = 7680
Width = 1935
End
Begin MSAdodcLib.Adodc Adodata1
Height = 615
Left = 2760
Top = 7680
Width = 2295
_ExtentX = 4048
_ExtentY = 1085
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=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=F:\schoolgroup\school.mdb"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=F:\schoolgroup\school.mdb"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "student"
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
End
Attribute VB_Name = "querystud"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim dd(5) As Boolean
UserName = ""
txtSQL = "select * from student where "
If Option1(0).Value Then
If Trim(Text1.Text) = " " Then
sMeg = "班级不能为空"
MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
Text1.SetFocus
Exit Sub
Else
dd(0) = True
If dd(0) Then
UserName = Trim(Text1.Text) '
txtSQL = txtSQL & "班级 = '" & UserName & "' "
ElseIf UserName <> " " Then
txtSQL = txtSQL & "班级 = '" & UserName & "%' "
'txtSQL = txtSQL & "班级 = '%" & UserName & "' "
'txtSQL = txtSQL & "班级 = '%" & UserName & "%' "
End If
End If
ElseIf Option1(1).Value Then
If Trim(Text2.Text) = "" Then
sMeg = "姓名不能为空"
MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
Text2.SetFocus
Exit Sub
Else
dd(1) = True
If dd(1) Then
txtSQL = txtSQL & " 姓名 = '" & Text2.Text & "'"
Else
txtSQL = txtSQL & " 姓名 like '" & Text2.Text & "%'" Or " 姓名 like '%" & Text2.Text & "'"
End If
End If
'End If
'----------------------------
ElseIf Option1(2).Value Then
If Trim(Text3.Text) = "" Then
sMeg = "学号不能为空"
MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
Text3.SetFocus
Exit Sub
Else
dd(2) = True
If dd(2) Then
txtSQL = txtSQL & " 学号 = '" & Text3.Text & "'"
Else
txtSQL = txtSQL & " 学号 like '" & Text3.Text & "%'"
End If
End If
ElseIf Option1(3).Value Then
Text4.Text = ""
Text4.Text = ""
If Trim(Text4.Text) = " " Then
sMeg = "家庭住址不能为空"
MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
Text4.SetFocus
Exit Sub
Else
dd(3) = True
If dd(3) Then
txtSQL = txtSQL & " 家庭住址 = '" & Text4.Text & " ' "
Else
txtSQL = txtSQL & " 家庭住址 like '" & Text4.Text & "%'"
End If
End If
ElseIf Option1(4).Value Then
If Trim(Text5.Text) = "" Then
sMeg = "宿舍号不能为空"
MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
Text5.SetFocus
Exit Sub
Else
'xuehao is number ?
If Not IsNumeric(Trim(Text5.Text)) Then
MsgBox "请输入数字!", vbOKOnly + vbExclamation, "警告"
Exit Sub
Text5.Text = " "
Text5.SetFocus
End If
dd(4) = True
If dd(4) Then
txtSQL = txtSQL & " 宿舍号 = '" & Text5.Text & "'"
Else
txtSQL = txtSQL & " 宿舍号 like '" & Text5.Text & "%'"
End If
End If
End If
If Not (dd(0) Or dd(1) Or dd(2) Or dd(3) Or dd(4)) Then
MsgBox "请设置查询条件!", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
txtSQL = txtSQL & " order by 学号 "
Set dream = ExecuteSQL(txtSQL, Msgtext)
If dream.EOF = True Then 'exsit record ?
MsgBox "没有此记录!", 48, "警告"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Else
End If
End Sub
Private Sub Command3_Click()
Dim i As Integer, j As Integer
Dim slapp As Excel.Application
Dim row, col As Integer
'Screen.MousePointer = 11
Set slapp = New Excel.Application
slapp.Visible = True '
Set xlbook = slapp.Workbooks.Add
Set xlsheet = xlbook.Worksheets(1)
'[[[[[[[[[[[[
With slapp
slapp.Range("A1").Value = "学号"
slapp.Range("B1").Value = "姓名"
slapp.Range("C1").Value = "性别"
slapp.Range("D1").Value = "民族"
slapp.Range("E1").Value = "团员与否"
slapp.Range("F1").Value = "出生日期"
slapp.Range("G1").Value = "入校日期"
slapp.Range("H1").Value = "班级"
slapp.Range("I1").Value = "宿舍"
slapp.Range("J1").Value = "宿舍电话号码"
slapp.Range("K1").Value = "家长姓名"
slapp.Range("L1").Value = "联系电话号码"
slapp.Range("M1").Value = "中考成绩"
slapp.Range("N1").Value = "家庭住址"
slapp.Range("O1").Value = "备注"
End With
']]]]]]]]]]]]
Adodata1.Recordset.MoveFirst
'txtnumber.Text = Adodata1.Recordset.RecordCount
'Adodata1.Recordset.MoveLast
i = 1
Do While Adodata1.Recordset.EOF = False
For j = 0 To 13 'txtnumber '8-----txtnumber
If IsNull(DataGrid1.Text) = False Then
xlsheet.Cells(i + 1, j + 1) = Adodata1.Recordset(j)
End If
Next j
Adodata1.Recordset.MoveNext
i = i + 1
Loop
End Sub
Private Sub Command4_Click()
Set dream = Nothing
Unload Me
End Sub
Private Sub Command5_Click()
'----------------------------
'----------------------------
End Sub
Private Sub Form_Load()
Set dream = New ADODB.Recordset
txtSQL = "select * from student order by 学号"
'count total
Adodata1.Recordset.MoveFirst
txtnumber.Text = Adodata1.Recordset.RecordCount
Adodata1.Recordset.MoveLast
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set dream = Nothing
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -