?? form4.frm
字號:
VERSION 5.00
Begin VB.Form Form4
Appearance = 0 'Flat
BackColor = &H00C0C0C0&
BorderStyle = 1 'Fixed Single
Caption = "查詢"
ClientHeight = 2970
ClientLeft = 45
ClientTop = 330
ClientWidth = 4530
LinkTopic = "Form4"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 2970
ScaleWidth = 4530
Begin VB.TextBox Text1
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 255
Index = 3
Left = 1920
TabIndex = 9
Top = 2040
Width = 1695
End
Begin VB.TextBox Text1
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 255
Index = 2
Left = 1920
TabIndex = 8
Top = 1560
Width = 1695
End
Begin VB.TextBox Text1
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 255
Index = 1
Left = 1920
TabIndex = 7
Top = 1080
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 255
Left = 2880
TabIndex = 6
Top = 2520
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "確定"
Height = 255
Left = 600
TabIndex = 5
Top = 2520
Width = 1095
End
Begin VB.TextBox Text1
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 255
Index = 0
Left = 1920
TabIndex = 0
Text = " "
Top = 600
Width = 975
End
Begin VB.Label Label5
Caption = "按姓名關鍵字查詢:"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 255
Left = 0
TabIndex = 10
Top = 2040
Width = 2775
End
Begin VB.Label Label3
Caption = "學生檔案查詢"
BeginProperty Font
Name = "楷體_GB2312"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1200
TabIndex = 4
Top = 0
Width = 2175
End
Begin VB.Label Label1
Caption = "學號:"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 255
Left = 1200
TabIndex = 3
Top = 600
Width = 975
End
Begin VB.Label Label2
Caption = "姓名:"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 255
Left = 1200
TabIndex = 2
Top = 1080
Width = 1455
End
Begin VB.Label Label4
Caption = "班級:"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 255
Left = 1200
TabIndex = 1
Top = 1560
Width = 1575
End
End
Attribute VB_Name = "Form4"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim aa As Integer
txtsql = ""
If Trim(Text1(0).Text) <> "" Then
aa = 1
If txtsql = "" Then
txtsql = "xj.學號='" & Trim(Text1(0).Text) & "'"
Else
txtsql = txtsql & "and xj.學號='" & Trim(Text1(0).Text) & "'"
End If
End If
If Trim(Text1(1).Text) <> "" Then
aa = 1
If txtsql = "" Then
txtsql = "xj.姓名='" & Trim(Text1(1).Text) & "'"
Else
txtsql = txtsql & "and xj.姓名='" & Trim(Text1(1).Text) & "'"
End If
End If
If Trim(Text1(2).Text) <> "" Then
aa = 1
If txtsql = "" Then
txtsql = "xj.班級='" & Trim(Text1(2).Text) & "'"
Else
txtsql = txtsql & "and xj.班級='" & Trim(Text1(2).Text) & "'"
End If
End If
If Trim(Text1(3).Text) <> "" Then
aa = 1
txtsql = ""
txtsql = "xj.姓名 like '%" & Trim(Text1(3).Text) & "%'"
End If
If aa = 0 Then
ss = MsgBox("你至少要輸入一個條件以上才能查詢!", , " 警告")
Text1(0).SetFocus
Exit Sub
End If
Dim str As String
str = "select * from xj where " & txtsql
Dim mrc As ADODB.Recordset
Set mrc = ExecuteSQL(str)
If mrc.EOF = True Then
zzz = MsgBox("對不起,沒有此學生的檔案記錄!", vbOKOnly, "查詢")
Form4.ZOrder (0)
Form4.Text1(0).SetFocus
Exit Sub
End If
txtsql = "select xj.學號,xj.姓名,xj.性別,class.年級,xj.班級,class.專業,class.年制,xj.出生年月,xj.家庭住址,xj.郵政編碼,xj.聯系電話,xj.入學時間,xj.備注 from xj inner join class on xj.班級=class.班級 where " & txtsql & "order by class.年級 desc,class.班級 desc,xj.學號 desc"
Form3.printstr = txtsql
find = True
Form3.Show
'select xj.學號,xj.姓名,xj.性別,class.年級,xj.班級,class.專業,class.年制,xj.出生年月,xj.家庭住址,xj.郵政編碼,xj.聯系電話,xj.入學時間,xj.備注 from xj inner join class on xj.班級=class.班級 where xj.班級='01美術一' or 年級='01美術一' order by class.年級 desc,class.班級 desc,xj.學號 desc
Form3.Caption = "學生檔案查詢結果"
Form3.showtitle
Form3.showdata
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Activate()
find = True
End Sub
Private Sub Form_LostFocus()
Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
find = False
'Form3.Caption = "瀏覽學生檔案"
End Sub
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = 39 Then
KeyAscii = 0
End If
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -