|
使用下面代码可以修改自动ID (引用ADOX), 不过, 最好先备份数据
Public Function ChangeIdentity(ByVal strTable As String, ByVal strColumn As String, _
ByVal lngSeed As Long, ByVal lngIncrement As Long) As Boolean
On Error GoTo ErrHandler
Dim cat As New ADOX.Catalog
Set cat.ActiveConnection = CurrentProject.Connection
cat.Tables(strTable).Columns(strColumn).Properties("Seed").Value = lngSeed
cat.Tables(strTable).Columns(strColumn).Properties("Increment").Value = lngIncrement
ChangeIdentity = True
ExitProcedure:
Set cat = Nothing
Exit Function
ErrHandler:
MsgBox Err.Description, vbCritical
Resume ExitProcedure
End Function |
|