Public Function LinkNewTable( _
ByVal TableName As String, _
ByVal SourceTableName As String) _
As Boolean
Const Master As String = "SomeCurrentlyLinkedTable"
Const Schema As String = "dbo"
Dim Database As DAO.Database
Dim Table As DAO.TableDef
Dim Connect As String
Dim Success As Boolean
Set Database = CurrentDb
Set Table = Database.TableDefs(Master)
Connect = Table.Connect
Table.Close
Set Table = Database.CreateTableDef(TableName)
Table.SourceTableName = Schema & "." & SourceTableName
Table.Connect = Connect
Database.TableDefs.Append Table
Database.TableDefs.Refresh
Success = Not CBool(Err.Number)
Set Table = Nothing
LinkNewTable = Success
End Function
2条答案
按热度按时间rqdpfwrv1#
请验证新视图是否与Access中已显示的视图具有相同的权限。如果权限不同,请修改未显示的视图的权限。
ou6hu8tu2#
运行一个小函数: