Re: Error 3251 using ADO & VBA to drop a table!



I am considering moving to DAO, but what I think it is quite strange is that
if I remove all tables from the database using the algorithm below, it
works!!So it seems that it can't replace links at the same time that the
tables are processed!

That's what I don't understand.

Public Function RemoveDataBase(Optional links As Boolean = True) As Boolean
Dim tbls As New Collection, tblName As Variant
Dim cat As New ADOX.Catalog, tbl As ADOX.table
cat.ActiveConnection = CurrentProject.Connection

For Each tbl In cat.Tables
If tbl.Type = "TABLE" Or (links And tbl.Type = "LINK") Then
tbls.Add tbl.name, tbl.name
End If
Next

For Each tblName In tbls
'Stops removing!
If Not RemoveTable(tblName, True) Then
RemoveDataBase = False
GoTo RemoveDataBase_Exit
End If
Next

RemoveDataBase = True
RemoveDataBase_Exit:
Set cat = Nothing
Set tbls = Nothing
Set tbl = Nothing
End Function


"Bob Barrows [MVP]" wrote:

Darizotas wrote:
Hello,

I have a MDE file that contains its own model and I am trying to link
their tables to a MDB file. I am trying to do this using ADO 2.8.

The method that I am following is to traverse ADOX.Tables Collection
of the MDE data model and replacing each one with the corresponding
table at the MDB file. But after replacing several tables I found the
runtime error 3251 - OPERATION IS NOT SUPPORTED FOR THIS TYPE OF
OBJECT.

So wouldn't it make sense to determine the object type that causes it to
fail?

Having said that, I'm wondering if you would have better success using
DAO for this task rather than ADOX, which could never do all the things
the DAO could do. Check in an Access VBA newsgroup.


--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.



.



Relevant Pages

  • Re: Error 3251 using ADO & VBA to drop a table!
    ... Dim tbls As New Collection, ... their tables to a MDB file. ... DAO for this task rather than ADOX, which could never do all the things ... Check in an Access VBA newsgroup. ...
    (microsoft.public.data.ado)
  • Re: Error 3251 using ADO & VBA to drop a table!
    ... I have a MDE file that contains its own model and I am trying to link ... their tables to a MDB file. ... DAO for this task rather than ADOX, which could never do all the things ... Check in an Access VBA newsgroup. ...
    (microsoft.public.data.ado)