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

📄 findcd.frm

📁 VB影碟出租系统
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         EndProperty
         BeginProperty Column01 
            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 
            EndProperty
            BeginProperty Column01 
            EndProperty
         EndProperty
      End
      Begin VB.Label Label2 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         BackStyle       =   0  'Transparent
         Caption         =   "影碟数量:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   255
         Left            =   360
         TabIndex        =   11
         Top             =   600
         Width           =   1095
      End
      Begin VB.Label LabelSum 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         BackStyle       =   0  'Transparent
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   255
         Left            =   1440
         TabIndex        =   10
         Top             =   600
         Width           =   735
      End
      Begin VB.Label Label1 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         BackStyle       =   0  'Transparent
         Caption         =   "请输入你要查询的数据:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   255
         Left            =   480
         TabIndex        =   9
         Top             =   6480
         Width           =   2415
      End
   End
End
Attribute VB_Name = "FindCD"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Download by http://www.codefans.net
Option Explicit

Private Sub Command1_Click()
Dim SQL As String
If Option1.Value = False And Option2.Value = False And Option3.Value = False And Option4.Value = False Then
   MsgBox "请你先选择你要查询类型!", vbInformation + vbOKOnly, "警告"
   Option1.Value = True
   Text1.SetFocus
   Exit Sub
Else
   If Text1.Text <> "" Then
       If Check1.Value = 0 Then
          If Option1.Value = True Then
             SQL = "select * from cdinfo where 影碟编号='" & Text1.Text & "'"
          End If
          If Option2.Value = True Then
             SQL = "select * from cdinfo where 影碟名称='" & Text1.Text & "'"
          End If
          If Option3.Value = True Then
             SQL = "select * from cdinfo where 影碟类别='" & Text1.Text & "'"
          End If
          If Option4.Value = True Then
             SQL = "select * from cdinfo where 入店时间=#" & Text1.Text & "#"
          End If
       ElseIf Check1.Value = 1 Then
          If Option1.Value = True Then
             SQL = "select * from cdinfo where 影碟编号 like '%" & Text1.Text & "%'"
          End If
          If Option2.Value = True Then
             SQL = "select * from cdinfo where 影碟名称 like '%" & Text1.Text & "%'"
          End If
          If Option3.Value = True Then
             SQL = "select * from cdinfo where 影碟类别 like '%" & Text1.Text & "%'"
          End If
          If Option4.Value = True Then
             SQL = "select * from cdinfo where 入店时间 like '%" & Text1.Text & "%'"
          End If
       End If
   Else
       MsgBox "请你输入你要查询数据的关键词!", vbInformation + vbOKOnly, "警告"
       Text1.SetFocus
       Exit Sub

   End If
End If

Adodc1.RecordSource = SQL

Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Set DataGrid1.DataSource = Adodc1
LabelCS
Else
MsgBox "你所查询的影碟不存在,请你确认后再重新输入数据关键词查询!", vbInformation + vbOKOnly, "信息"
Text1.Text = ""
Text1.SetFocus
End If
End Sub

Private Sub Command2_Click()
Option1.Value = False
Option2.Value = False
Option3.Value = False
Option4.Value = False
Option5.Value = False
Text1.Text = ""
Text1.SetFocus
Check1.Value = 0
End Sub

Private Sub Command3_Click()
If MDIForm1.MdSet.Visible = False Then
   MsgBox "你不是管理员用户,不能进行修改数据!", vbInformation + vbOKOnly, "警告"
   Exit Sub
End If
If DataGrid1.Row >= 0 Then
EditCD.Show vbModal
Else
MsgBox "暂没有影碟信息可供修改!", vbInformation + vbOKOnly, "警告"
Option1.Value = True
Text1.SetFocus
End If
End Sub

Private Sub Command4_Click()
Dim SQL As String
Dim vbName As String
If MDIForm1.MdSet.Visible = False Then
   MsgBox "你不是管理员用户,不能删除数据!", vbInformation + vbOKOnly, "警告"
   Exit Sub
End If
If DataGrid1.Row < 0 Then
 MsgBox "暂没有影碟信息可供删除!", vbInformation + vbOKOnly, "提示"
 Exit Sub
End If
DataGrid1.Col = 1
vbName = DataGrid1.Text
If MsgBox("你确实要删除此影碟名称为“" & vbName & "”的信息吗?", vbInformation + vbYesNo, "删除信息") = vbYes Then
    DataGrid1.Col = 0
    SQL = "select 是否借出 from cdinfo where 影碟编号=""" & DataGrid1.Text & """"
    OpenDBFile
    OpenRS (SQL)
    If gRst("是否借出") = -1 Then
       If MsgBox("名称为“" & vbName & "”的影碟还没归还,是否真的删除?", vbInformation + vbYesNo, "是否删除") = vbNo Then
           CloseRS
           Exit Sub
       End If
    End If
    CloseRS
    With Adodc1.Recordset
         .Delete
    End With
    MsgBox "此影碟名称为“" & vbName & "”的信息已经删除!", vbInformation + vbOKOnly, "提示"
End If
End Sub

Private Sub Command5_Click()
Unload Me
End Sub

Private Sub Form_Load()
Adodc1.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=" _
                         & App.Path & "\cdlent.mdb;Mode=ReadWrite;Persist Security Info=True;Jet OLEDB:Database Password=123456"
Adodc1.CursorLocation = adUseClient
Adodc1.CommandType = adCmdText

SkyGzForm1.Caption = Me.Caption
SkyGzForm1.hWnd = Me.hWnd
End Sub

Private Sub Option1_Click()
Label1.Caption = Option1.Caption
Text1.SetFocus
End Sub

Private Sub Option2_Click()
Label1.Caption = Option2.Caption
Text1.SetFocus
End Sub

Private Sub Option3_Click()
Label1.Caption = Option3.Caption
Text1.SetFocus
End Sub

Private Sub Option4_Click()
Label1.Caption = Option4.Caption
Text1.SetFocus
End Sub

Private Sub Option5_Click()
Dim SQL As String

SQL = "select * from cdinfo"
Adodc1.RecordSource = SQL
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
    Set DataGrid1.DataSource = Adodc1
    LabelCS
Else
MsgBox "目前数据库为空!请添加影碟!", vbInformation + vbOKOnly, "信息"
End If
    
End Sub

Public Sub LabelCS()
LabelSum.Caption = Adodc1.Recordset.RecordCount & "部"
End Sub


Private Sub text1_keypress(keyascii As Integer)
If keyascii = "13" And Text1.Text <> "" Then
       Dim SQL As String

    
     If Option1.Value = False And Option2.Value = False And Option3.Value = False And Option4.Value = False Then
           MsgBox "请你选择你要查询类型!", vbInformation + vbOKOnly, "警告"
           Option1.Value = True
           Text1.SetFocus
           Exit Sub
     Else
        If Check1.Value = 0 Then
          If Option1.Value = True Then
             SQL = "select * from cdinfo where 影碟编号='" & Text1.Text & "'"
          End If
          If Option2.Value = True Then
             SQL = "select * from cdinfo where 影碟名称='" & Text1.Text & "'"
          End If
          If Option3.Value = True Then
             SQL = "select * from cdinfo where 影碟类别='" & Text1.Text & "'"
          End If
          If Option4.Value = True Then
             SQL = "select * from cdinfo where 入店时间=#" & Text1.Text & "#"
          End If
        ElseIf Check1.Value = 1 Then
          If Option1.Value = True Then
             SQL = "select * from cdinfo where 影碟编号 like '%" & Text1.Text & "%'"
          End If
          If Option2.Value = True Then
             SQL = "select * from cdinfo where 影碟名称 like '%" & Text1.Text & "%'"
          End If
          If Option3.Value = True Then
             SQL = "select * from cdinfo where 影碟类别 like '%" & Text1.Text & "%'"
          End If
          If Option4.Value = True Then
             SQL = "select * from cdinfo where 入店时间 like '%" & Text1.Text & "%'"
          End If
        End If
      End If

    Adodc1.RecordSource = SQL

    Adodc1.Refresh
    If Adodc1.Recordset.RecordCount > 0 Then
          Set DataGrid1.DataSource = Adodc1
          LabelCS
    Else
          MsgBox "对不起,你查询的影碟不存在!", vbInformation + vbOKOnly, "信息"
          Text1.Text = ""
          Text1.SetFocus
    End If
ElseIf keyascii = "13" And Text1.Text = "" Then
   MsgBox "请你输入你要查询的数据关键字!", vbInformation + vbOKOnly, "信息"
   Text1.SetFocus
End If
End Sub

Private Sub Form_Resize()
SkyGzForm1.Left = 0
SkyGzForm1.Top = 0
Me.Width = SkyGzForm1.Width - 5
Me.Height = SkyGzForm1.Height
Call SkyGzForm1.SetRgn(Me, 5)
End Sub

Private Sub SkyGzForm1_UnloadClick()
Unload Me
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -