Run Time error 3001 Invalid Argument

  • Thread starter Thread starter Paul Burdett
  • Start date Start date
P

Paul Burdett

Hi Guys

I have the following code trying to link to a database using Access 2000 on
XP Pro and it falls over at the TablDefs.Append line.

Sub CreateLinkedTable()

Dim tbfNewAttached As DAO.TableDef
Dim LocalDB As DAO.Database

Set LocalDB = CurrentDb()

Set tbfNewAttached = LocalDB.CreateTableDef("MyContacts")
With tbfNewAttached
.Connect = ";DATABASE = C:\My_Data.mdb"
.SourceTableName = "tblContacts"
End With
Set LocalDB = CurrentDb()
LocalDB.TableDefs.Append tbfNewAttached 'This is where it complains

End Sub

The message I get is:
'Run time error 3001. Invalid Argument'

I have checked the references for DAO 3.6 and all is OK.

Thoughts welcome

Kind Regards

Paul
 
I suspect it's due to the fact that you're resetting LocalDB. Get rid of the
second one.
 
Hi Doug

Thansk and well spotted.

Same problem though and the same message.

Any more thoughts anyone?

Yours

Paul
 
Is it possible that you've specified an incorrect path to the database, or
that tblContacts doesn't exist in that database?
 
Hi Doug

Again good thoughts but have checked them and have used the link manager to
create the link and delete it using the same path and table name.

Readong around the sundry web sites there may be some thing to do with A2K
and WP but I am nor sure.

Yours

Paul
Don't know what to do next.
 
Do you actually have the spaces on either side of the equal sign in
";DATABASE = C:\My_Data.mdb"? Get rid of them:

..Connect = ";DATABASE=C:\My_Data.mdb"
 
Back
Top