⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form4.frm

📁 作为计算机应用的一个方向
💻 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 + -