ADODB is a library for generic data access. Libraries don't have properties.
They have classes, members and enum types. Members can have properties.
If you don't use CurrentProject.Connection you need to set up your connection
string to include the path to the back end db and name the data provider.
Since you're new to developing dbs, the procs below would be easier to learn
from and you could reuse the code for other procs. Call the chgseed proc to
change the seed with testchgseed (after you change the values to match the
path to your back end file, table name etc.)
Public Sub testchgseed()
On Error GoTo ProcErr
Dim strDb As String
Dim strTable As String
Dim strCol As String
Dim lngSeed As Long
strDb = "c:\dbs\db_be.mdb" 'path to be
strTable = "tablename"
strCol = "id" 'autonumber column
lngSeed = 583 'next no.
Call chgseed(strDb, strTable, strCol, lngSeed)
ProcExit:
Exit Sub
ProcErr:
Debug.Print Err.Number & ":" & Err.Description
Resume ProcExit
End Sub
Public Sub chgseed(strDbPath As String, strTable As String, strCol As String,
lngSeed As Long)
On Error GoTo ProcErr
Dim conn As ADODB.Connection
Dim strConnect As String
strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & strDbPath 'connection string
Set conn = New ADODB.Connection
conn.Open strConnect
conn.Execute "ALTER TABLE " & strTable _
& " ALTER COLUMN " & strCol _
& " COUNTER (" & lngSeed & ");"
ProcExit:
conn.Close 'close conn when not needed anymore
Set conn = Nothing 'release memory
Exit Sub
ProcErr:
If Err.Number = -2147467259 Then
Debug.Print "The database file cannot be located.", _
vbCritical, strDbPath
Exit Sub
Else
Debug.Print Err.Number & ":" & Err.Description
Resume ProcExit
End If
End Sub
Chris
Relatively new to Access, is there a property of ADODB to set it to backend?
[quoted text clipped - 4 lines]