M
Mohan
Hi
I am using a table to import data from text files. the text filess are
daily files with about 60K rows per day. So after one month, I clean out the
data and I want to reset the auto number
I am using the follwoing code to reset the auto number:
===========
Public Sub ResetAutoNumSeed(sTableName As String, sFieldName As String, num
As Long)
On Error GoTo ErrHandler
Dim cat As New ADOX.Catalog
Dim tbl As ADOX.Table
Dim col As ADOX.Column
Set cat.ActiveConnection = CurrentProject.Connection
Set tbl = cat.Tables(sTableName)
Set col = tbl.Columns(sFieldName)
col.Properties("Seed") = num
CleanUp:
Set col = Nothing
Set tbl = Nothing
Set cat = Nothing
Exit Sub
ErrHandler:
MsgBox "Error in resetAutoNumSeed( )." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & vbCrLf & Err.Description
Err.Clear
GoTo CleanUp
End Sub
==============
But the problem is its working if the table is in the sam mdb file as the
code. It won't work if the table is a linked table. How can I reset the
auto number of a linked table?
One option I thought of: Put the same code in the db where the table
resides and call this from my fron-end code access file. But I don't know how
to do this..
Can anyone help!!
Thanks
Mohan
I am using a table to import data from text files. the text filess are
daily files with about 60K rows per day. So after one month, I clean out the
data and I want to reset the auto number
I am using the follwoing code to reset the auto number:
===========
Public Sub ResetAutoNumSeed(sTableName As String, sFieldName As String, num
As Long)
On Error GoTo ErrHandler
Dim cat As New ADOX.Catalog
Dim tbl As ADOX.Table
Dim col As ADOX.Column
Set cat.ActiveConnection = CurrentProject.Connection
Set tbl = cat.Tables(sTableName)
Set col = tbl.Columns(sFieldName)
col.Properties("Seed") = num
CleanUp:
Set col = Nothing
Set tbl = Nothing
Set cat = Nothing
Exit Sub
ErrHandler:
MsgBox "Error in resetAutoNumSeed( )." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & vbCrLf & Err.Description
Err.Clear
GoTo CleanUp
End Sub
==============
But the problem is its working if the table is in the sam mdb file as the
code. It won't work if the table is a linked table. How can I reset the
auto number of a linked table?
One option I thought of: Put the same code in the db where the table
resides and call this from my fron-end code access file. But I don't know how
to do this..
Can anyone help!!
Thanks
Mohan