Problems with serial number

G

Guest

Hi
I have several tables with autonumber fields which I am setting a system for
autoupdating from historical data.

However I cant get the autonember field to reset to next value .
When I try this code from http://support.microsoft.com/kb/287756/

Function ChangeSeed(strTbl As String, strCol As String, lngSeed As Long) As
Boolean
'You must pass the following variables to this function.
'strTbl = Table containing autonumber field
'strCol = Name of the autonumber field
'lngSeed = Long integer value you want to use for next AutoNumber.

Dim cnn As ADODB.Connection
Dim cat As New ADOX.Catalog
Dim col As ADOX.Column

'Set connection and catalog to current database.
Set cnn = CurrentProject.Connection
cat.ActiveConnection = cnn

Set col = cat.Tables(strTbl).Columns(strCol)

col.Properties("Seed") = lngSeed
cat.Tables(strTbl).Columns.Refresh
If col.Properties("seed") = lngSeed Then
ChangeSeed = True
Else
ChangeSeed = False
End If
Set col = Nothing
Set cat = Nothing
Set cnn = Nothing

End Function

I get "ByRef argument ype mismatch"

any help appreciated
 
G

Guest

Please post the line of code you're using to call this function. It sounds
like one or more of the values you're passing in are of the wrong type.

Barry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top