form1.frm

来自「vb数据库编程资料」· FRM 代码 · 共 78 行

FRM
78
字号
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   2055
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   4335
   LinkTopic       =   "Form1"
   ScaleHeight     =   2055
   ScaleWidth      =   4335
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   3120
      TabIndex        =   4
      Text            =   "Text1"
      Top             =   0
      Width           =   735
   End
   Begin VB.CommandButton Command1 
      Caption         =   "删除查询"
      Height          =   375
      Left            =   2280
      TabIndex        =   1
      Top             =   960
      Width           =   1815
   End
   Begin VB.ListBox List1 
      Height          =   1320
      Left            =   360
      TabIndex        =   0
      Top             =   480
      Width           =   1455
   End
   Begin VB.Label Label2 
      Caption         =   "查询数:"
      Height          =   255
      Left            =   2280
      TabIndex        =   3
      Top             =   120
      Width           =   615
   End
   Begin VB.Label Label1 
      Caption         =   "教学数据库中的查询"
      Height          =   255
      Left            =   360
      TabIndex        =   2
      Top             =   120
      Width           =   1695
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim CurDir As String
Dim jxdb As Database
Dim chaxun As QueryDef
Private Sub Command1_Click()
  jxdb.QueryDefs.Delete List1.Text  '删除选定的查询
  Call DispQueryName   '调用DispQueryName重新显示查询名和查询的数目
End Sub
Private Sub Form_Load()
  Set jxdb = DBEngine.Workspaces(0).OpenDatabase(App.Path & "\教务管理") '打开数据库
  Call DispQueryName '调用DispQueryName显示表名和查询的数目
End Sub
Private Sub DispQueryName()
  List1.Clear  '清除掉列表框中的列表项
  With jxdb
     For Each chaxun In .QueryDefs
        List1.AddItem chaxun.Name  '把查询名添加到列表框中
     Next chaxun
     Text1.Text = .QueryDefs.Count  '把查询的数量显示在文本框中
  End With
End Sub

⌨️ 快捷键说明

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