|
|
Создание Таблицы (DAO)
Private Sub CreateTempTable()
Const strTableName As String = "tmpДубли"
Dim tbl As DAO.TableDef
Dim idx As DAO.Index
Dim fld As DAO.Field
On Error Resume Next
CurrentDb.TableDefs.Delete strTableName
Err.Clear
On Error GoTo CreateTempTableErr
Set tbl = CurrentDb.CreateTableDef(strTableName)
With tbl
.Fields.Append tbl.CreateField("Max_ID", dbLong)
Set idx = .CreateIndex("Primary Key")
With idx
.Fields.Append .CreateField("Max_ID")
.Unique = True
.Primary = True
End With
.Indexes.Append idx
End With
CurrentDb.TableDefs.Append tbl
CreateTempTableBye:
On Error Resume Next
Set idx = Nothing
Set fld = Nothing
Set tbl = Nothing
Exit Sub
CreateTempTableErr:
MsgBox "Произошла ошибка при выполнении процедуры " & _
"[CreateTempTable] :" & vbCrLf & _
Err.Description & vbCrLf & _
"Номер ошибки = " & Err.Number, vbCritical
Resume CreateTempTableBye
End Sub
|
|