
Please Help...Linking MBD's with code -- ERROR 3001 - Invalid Argument
Hello,
Here is my problem. I'm trying to link two tables from one mdb to
another. I found this code posted everywhere (books, net...I think even the
bathroom wall had it). Anyway...all is fine up until you hit the last line.
The tabledef is created then the connection is made (path and database are
correct). I set the sourcetablename (which is also correct) BUT once I hit
MainDB.TableDefs.Append NewLinkedTDF -- POOF!!! Error 3001 - Invalid
Argument. I've looked at this code for a few hours trying different ways to
do things, to no avail. If you've run into this problem please help.
As a note....MainDB is already opened (Sub Main) and the LinkFromDBName mdb
does exist where the path states.
Set NewLinkedTDF = MainDB.CreateTableDef(tbl)
NewLinkedTDF.Connect = "; DATABASE = " & DBPath & "\" & LinkFromDBName
NewLinkedTDF.SourceTableName = tbl
MainDB.TableDefs.append NewLinkedTDF
Any help is greatly appreciated
Sincerely,
Farid