📄 form1.ebf
字号:
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Tahoma"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = -2147483640
Alignment = 0
Value = 0
End
Begin VBCE.CheckBox chkdaxiao
Height = 375
Left = 840
TabIndex = 5
Top = 3000
Width = 1335
_cx = 2355
_cy = 661
BackColor = -2147483648
Caption = "区分大小写"
Enabled = -1 'True
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Tahoma"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = -2147483640
Alignment = 0
Value = 0
End
Begin VBCE.CheckBox chkNull
Height = 375
Left = 2280
TabIndex = 4
Top = 3000
Width = 1215
_cx = 2143
_cy = 661
BackColor = -2147483648
Caption = "NULL First"
Enabled = -1 'True
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Tahoma"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = -2147483640
Alignment = 0
Value = 0
End
Begin VBCE.CommandButton but_path
Height = 375
Left = 2640
TabIndex = 3
Top = 0
Width = 855
_cx = 1508
_cy = 661
BackColor = 12632256
Caption = ".........."
Enabled = -1 'True
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Tahoma"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Style = 0
End
Begin VBCE.CommandButton but_createindex
Height = 375
Left = 240
TabIndex = 2
Top = 3480
Width = 1095
_cx = 1931
_cy = 661
BackColor = 12632256
Caption = "创建"
Enabled = -1 'True
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Tahoma"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Style = 0
End
Begin VBCE.CommandButton but_cancel
Height = 375
Left = 1440
TabIndex = 1
Top = 3480
Width = 1215
_cx = 2143
_cy = 661
BackColor = 12632256
Caption = "取消"
Enabled = -1 'True
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Tahoma"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Style = 0
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 Sub but_cancel_Click()
End Sub
Private Sub but_createindex_Click()
If datagrid.RowSel < 0 Then
MsgBox "请选择需要创建索引的字段", vbOKOnly, "提醒"
Exit Sub
ElseIf datagrid.RowSel = 0 Then
MsgBox "不能选择字段名称", vbOKOnly, "提醒"
Exit Sub
End If
Dim tem As String
tem = datagrid.TextMatrix(datagrid.RowSel, 0)
If Not table.State = adStateClosed Then
table.Close
End If
If Len(Trim(tx_index.Text)) = 0 Then
MsgBox "索引名称不能为空白", vbOKOnly, "注意"
Exit Sub
End If
Dim okornot As Integer
Dim sql, addition As String
okornot = MsgBox("是否创建索引" & tx_index.Text, vbOKCancel, "提醒")
If okornot = vbOK Then
If chkdesc.Value = 1 Then
addition = "DESC"
ElseIf chkdaxiao.Value = 1 Then
addition = "CASESENSITIVE"
Else
addition = "UNKNOWFIRST"
End If
sql = "CREATE INDEX " & tx_index.Text & " ON " & cb_tablename_index.List(cb_tablename_index.ListIndex) & "(" & datagrid.TextMatrix(datagrid.RowSel, 0) & " " & addition & ")"
Connection.Execute sql
If Err.Number > 0 Then
MsgBox "索引创建错误,请检查", vbOKOnly, "注意"
Else
MsgBox "索引创建成功,请检查", vbOKOnly, "注意"
End If
End If
End Sub
Private Sub but_path_Click()
CommonDialog1.Filter = "Pocket Access (*.cdb) | *.cdb"
CommonDialog1.ShowOpen
If CommonDialog1.FileName <> "" Then
Dim ppos, lpos As Long
ppos = InStr(CommonDialog1.FileName, ".")
lpos = InStrRev(CommonDialog1.FileName, "\")
cb_dbname.Text = Mid(CommonDialog1.FileName, lpos + 1, ppos - lpos - 1)
End If
End Sub
Private Sub cb_tablename_index_Click()
If Not table.State = adStateClosed Then
table.Close
End If
table.Open cb_tablename_index.List(cb_tablename_index.ListIndex), Connection
If table.BOF And table.EOF Then
MsgBox table & " 没有任何记录", vbOKOnly, "注意"
Exit Sub
ElseIf Len(cb_tablename_index.List(cb_tablename_index.ListIndex)) = 0 Then
Exit Sub
Else
showallfields Form1
End If
End Sub
Private Sub Form_Load()
If Not table.State = adStateClosed Then
table.Close
End If
table.Open "MSysTables", Connection
table.MoveFirst
Do While Not table.EOF
If table.fields("TableName") <> "MSysTables" And _
table.fields("TableName") <> "MSysFields" And _
table.fields("TableName") <> "MSysIndexes" And _
table.fields("TableName") <> "MSysProcs" Then
cb_tablename_index.AddItem table.fields("TableName")
End If
table.MoveNext
Loop
cb_tablename_index.ListIndex = 0
If Not table.State = adStateClosed Then
table.Close
table.Open cb_tablename_index.List(cb_tablename_index.ListIndex), Connection
showallfields Form1
End If
cb_dbname.Text = "books"
End Sub
Private Sub Form_OKClick()
App.End
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -