نوشته شده توسط
karmand
برای rename کردن نام جدول از طریق vb و یا کپی یک جدول با نام جدید البته فقط structuerخالی آن کدی موجود است متشکرم
اين كد رو چك كنين
Public Function RenameTable(DatabaseName As String, _
ByVal OldTableName As String, _
ByVal NewTableName As String) As Boolean
'DataBaseName is the file/path name of the database
'OldTableName is the name of the table you want to rename
'NewTableName is new table name
'Returns true if successful, false otherwise
'Project must include reference to DAO
On Error GoTo errorhandler
Dim oDB As DAO.Database
Dim td As DAO.TableDef
Set oDB = Workspaces(0).OpenDatabase(DatabaseName)
On Error GoTo errorhandler
If Not TableExists(oDB, OldTableName) Then GoTo errorhandler
If TableExists(oDB, NewTableName) Then GoTo errorhandler
'Create table object
Set td = oDB.TableDefs(OldTableName)
td.Name = NewTableName
oDB.TableDefs.Refresh
oDB.Close
RenameTable = True
Exit Function
errorhandler:
If Not oDB Is Nothing Then oDB.Close
Set td = Nothing
End Function