📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 945
ClientLeft = 60
ClientTop = 450
ClientWidth = 2910
LinkTopic = "Form1"
ScaleHeight = 945
ScaleWidth = 2910
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "创建书名索引"
Height = 375
Left = 360
TabIndex = 0
Top = 240
Width = 2055
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim MyDB As Database '定义数据库变量
Dim MyTdf As TableDef '定义表变量
Dim MyIndex As Index '定义索引变量
Dim MyIxField As Field '定义索引字段变量
Set MyDB = OpenDatabase(VB.App.Path + "\图书管理", True, False) '打开数据库
Set MyTdf = MyDB.TableDefs("图书") '打开表
Set MyIndex = MyTdf.CreateIndex("SM") '创建索引
Set MyIxField = MyIndex.CreateField("书名") '为索引创建索引字段
MyIndex.Fields.Append MyIxField '把索引字段添加到索引变量的Indexes集合中
MyTdf.Indexes.Append MyIndex '把索引添加到表的索引集合Indexes中
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -