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

📄 form1.frm

📁 东莞赛马场查询系统,可通用为其他查询系统
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form Form1 
   Caption         =   "基本表"
   ClientHeight    =   5145
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   7305
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   ScaleHeight     =   5145
   ScaleWidth      =   7305
   ShowInTaskbar   =   0   'False
   Begin VB.Frame Frame2 
      Height          =   3855
      Left            =   120
      TabIndex        =   10
      Top             =   1200
      Width           =   7095
      Begin VB.CommandButton Command6 
         Caption         =   "刷  新"
         Height          =   375
         Left            =   4680
         TabIndex        =   14
         Top             =   3360
         Width           =   1335
      End
      Begin VB.CommandButton Command5 
         Caption         =   "删除记录"
         Height          =   375
         Left            =   3120
         TabIndex        =   13
         Top             =   3360
         Width           =   1335
      End
      Begin VB.CommandButton Command4 
         Caption         =   "添加记录"
         Height          =   375
         Left            =   1560
         TabIndex        =   12
         Top             =   3360
         Width           =   1335
      End
      Begin MSAdodcLib.Adodc Adodc1 
         Height          =   375
         Left            =   120
         Top             =   2880
         Width           =   6855
         _ExtentX        =   12091
         _ExtentY        =   661
         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         =   ""
         OLEDBString     =   ""
         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 MSDataGridLib.DataGrid DataGrid1 
         Height          =   2775
         Left            =   120
         TabIndex        =   11
         Top             =   120
         Width           =   6855
         _ExtentX        =   12091
         _ExtentY        =   4895
         _Version        =   393216
         HeadLines       =   1
         RowHeight       =   15
         BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ColumnCount     =   2
         BeginProperty Column00 
            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 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
   End
   Begin VB.Frame Frame1 
      Height          =   1215
      Left            =   120
      TabIndex        =   0
      Top             =   0
      Width           =   7095
      Begin VB.CommandButton Command3 
         Caption         =   "关健字查询"
         Height          =   375
         Left            =   3480
         TabIndex        =   9
         Top             =   720
         Width           =   1335
      End
      Begin VB.TextBox Text3 
         Height          =   375
         Left            =   960
         TabIndex        =   8
         Top             =   720
         Width           =   2415
      End
      Begin VB.CommandButton Command2 
         Caption         =   "姓名查询"
         Height          =   375
         Left            =   5760
         TabIndex        =   6
         Top             =   240
         Width           =   975
      End
      Begin VB.TextBox Text2 
         Height          =   375
         Left            =   4320
         TabIndex        =   5
         Top             =   240
         Width           =   1335
      End
      Begin VB.CommandButton Command1 
         Caption         =   "编号查询"
         Height          =   375
         Left            =   2280
         TabIndex        =   3
         Top             =   240
         Width           =   1095
      End
      Begin VB.TextBox Text1 
         Height          =   375
         Left            =   840
         TabIndex        =   2
         Top             =   240
         Width           =   1335
      End
      Begin VB.Label Label3 
         Caption         =   "关健字:"
         Height          =   255
         Left            =   240
         TabIndex        =   7
         Top             =   840
         Width           =   735
      End
      Begin VB.Label Label2 
         Caption         =   "姓名:"
         Height          =   255
         Left            =   3720
         TabIndex        =   4
         Top             =   360
         Width           =   735
      End
      Begin VB.Label Label1 
         Caption         =   "编号:"
         Height          =   255
         Left            =   240
         TabIndex        =   1
         Top             =   360
         Width           =   735
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private rs As New ADODB.Recordset
Private strconn As String
Private strsql As String
Private str1 As String
Private str2 As String
Private str3 As String
Private flag As Integer
Private var1 As Variant
Private intctr As Integer
Private intj As Integer
Private xulang As Integer

Private Sub Adodc1_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
Adodc1.Caption = "当前记录为:" & Adodc1.Recordset.AbsolutePosition & "/" & Adodc1.Recordset.RecordCount
End Sub

Private Sub Command1_Click()
On Error Resume Next
str1 = "select * from horse1 where 编号='" & Text1.Text & "'"
strconn = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\horse.mdb"
With rs
    If .State = adStateOpen Then
       .Close
    End If
    .ActiveConnection = strconn
    .Source = str1
    .LockType = adLockReadOnly
    .CursorLocation = adUseClient
    .CursorType = adOpenDynamic
    .Open
End With
Set DataGrid1.DataSource = rs
Set Adodc1.Recordset = rs
With DataGrid1
.Columns(0).Width = 900
.Columns(1).Width = 1600
.Columns(2).Width = 4000
End With
Adodc1.Caption = "当前记录为:" & Adodc1.Recordset.AbsolutePosition & "/" & Adodc1.Recordset.RecordCount
End Sub

Private Sub Command2_Click()
On Error Resume Next
str1 = "select * from horse1 where 姓名='" & Text2.Text & "'"
strconn = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\horse.mdb"
With rs
    If .State = adStateOpen Then
       .Close
    End If
    .ActiveConnection = strconn
    .Source = str1
    .LockType = adLockReadOnly
    .CursorLocation = adUseClient
    .CursorType = adOpenDynamic
    .Open
End With
Set DataGrid1.DataSource = rs
Set Adodc1.Recordset = rs
With DataGrid1
.Columns(0).Width = 900
.Columns(1).Width = 1600
.Columns(2).Width = 4000
End With
Adodc1.Caption = "当前记录为:" & Adodc1.Recordset.AbsolutePosition & "/" & Adodc1.Recordset.RecordCount
End Sub

Private Sub Command3_Click()
On Error Resume Next
strconn = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\horse.mdb"
strsql = "select * from horse1"
With rs
    If .State = adStateOpen Then
       .Close
    End If
    .ActiveConnection = strconn
    .Source = strsql
    .LockType = adLockReadOnly
    .CursorLocation = adUseClient
    .CursorType = adOpenDynamic
    .Open
End With
Set DataGrid1.DataSource = rs
Set Adodc1.Recordset = rs
With DataGrid1
.Columns(0).Width = 900
.Columns(1).Width = 1600
.Columns(2).Width = 4000
End With
Adodc1.Caption = "当前记录为:" & Adodc1.Recordset.AbsolutePosition & "/" & Adodc1.Recordset.RecordCount
On Error Resume Next
  If Form1.Command3.Caption = "关健字查询" Then
    rs.MoveFirst
  Else
    If (var1 + 1) < rs.RecordCount Or (var1 + 1) = rs.RecordCount Then
      rs.Bookmark = var1 + 1
    End If
  End If
  Do While Not rs.EOF
    For intctr = 0 To rs.Fields.Count - 1
      For intj = 1 To Len(rs(intctr))
        If Mid(rs(intctr), intj, Len(Text3.Text)) = Text3.Text Then
          'rs(intctr).Value.SetFocus
          flag = 1
          Form1.Command3.Caption = "查找下一个"
          var1 = rs.Bookmark
          Exit Do
        End If
      Next
    Next
  rs.MoveNext
  Loop
  If rs.EOF Then
    Form1.Command3.Caption = "关健字查询"
    If flag = 0 Then
      MsgBox "记录没有发现", , "查询提示"
    Else
      MsgBox "已查找到最后", , "查询提示"
    End If
    rs.MoveFirst
  End If
End Sub

Private Sub Command4_Click()
Form3.Show
End Sub

Private Sub Command5_Click()
If MsgBox("确定要删除记录吗?", vbYesNo, "删除记录") = vbYes Then
  Form1.Adodc1.Recordset.Delete
End If
End Sub

Private Sub Command6_Click()
On Error Resume Next
Unload Me
Set rs = Nothing
Call Form_Load
End Sub

Private Sub Command7_Click()
DataGrid1.EditActive = True
End Sub

Private Sub Form_Activate()
MDIForm1.StatusBar1.SimpleText = "正在查阅... ...基本情况表"
End Sub

Private Sub Form_Load()
On Error Resume Next
xulang = 1
strconn = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\horse.mdb"
strsql = "select * from horse1"
With rs
    If .State = adStateOpen Then
       .Close
    End If
    .ActiveConnection = strconn
    .Source = strsql
    .LockType = adLockOptimistic
    .CursorLocation = adUseClient
    .CursorType = adOpenDynamic
    .Open
End With
Set DataGrid1.DataSource = rs
Set Adodc1.Recordset = rs
With DataGrid1
.Columns(0).Width = 900
.Columns(1).Width = 1600
.Columns(2).Width = 4000
End With
Adodc1.Caption = "当前记录为:" & Adodc1.Recordset.AbsolutePosition & "/" & Adodc1.Recordset.RecordCount
End Sub

Private Sub Form_Resize()
If Form1.WindowState = 0 Then
Form1.Width = 7425
Form1.Height = 5550
Form1.Frame1.Width = 7095
Form1.Frame2.Width = 7095
Form1.DataGrid1.Width = 6855
Form1.DataGrid1.Height = 2775
Form1.Frame2.Height = 3855
Form1.Adodc1.Top = 2880
Form1.Command4.Top = 3360
Form1.Command5.Top = 3360
Form1.Command6.Top = 3360
xulang = 1
End If
If Form1.WindowState = 2 Then
Form1.Frame1.Width = Form1.ScaleWidth - 200
Form1.Frame2.Width = Form1.ScaleWidth - 200
Form1.Adodc1.Top = Form1.Frame2.Height - 2000
Form1.Frame2.Height = Form1.ScaleHeight - Form1.Frame1.Height - 200
Form1.DataGrid1.Width = Form1.Frame2.Width - 200
Form1.DataGrid1.Height = Form1.Frame2.Height - 1320
Form1.Command4.Top = Form1.Frame2.Height - 600
Form1.Command5.Top = Form1.Frame2.Height - 600
Form1.Command6.Top = Form1.Frame2.Height - 600
Form1.Adodc1.Top = Form1.Frame2.Height - 1200
xulang = 2
End If
End Sub

Private Sub Form_Unload(Cancel As Integer)
MDIForm1.StatusBar1.SimpleText = ""
Set rs = Nothing
End Sub

⌨️ 快捷键说明

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