Run Time error 3001 Invalid Argument

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
 
D

Douglas J. Steele

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

Paul Burdett

Hi Doug

Thansk and well spotted.

Same problem though and the same message.

Any more thoughts anyone?

Yours

Paul
 
D

Douglas J. Steele

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

Paul Burdett

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.
 
D

Douglas J. Steele

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"
 

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