如果不引用DAO3.6 ,如下代码运行会出错,代码如下:
Private Sub Command3_Click()
On Error GoTo Err_Command3_Click
Dim dbs As Database
Dim tdf As TableDef
Dim strNewName As String
Dim strName As String
Set dbs = CurrentDb
For Each tdf In dbs.TableDefs
strName = tdf.Name
If UCase(Left(strName, 3)) = "DBO" Then
strNewName = Right(strName, Len(strName) - 4)
tdf.Name = strNewName
tdf.RefreshLink
' Me.lbTable.Caption = tdf.Name
' DoEvents
End If
Next
MsgBox "去除DBO成功", 0 + 64
Exit_Command3_Click:
Exit Sub
Err_Command3_Click:
MsgBox Err.Description
Resume Exit_Command3_Click