Attaching External Access Table to Access Database

Attaching External Access Table to Access Database

Post by Jeff Sinas » Sat, 18 Nov 1995 04:00:00



>I'm having problems attaching an external access table to another
>access database.

>Here is the code.

>Sub attachTable ()

>Dim newTable as New TableDef
>Dim myDb as Database

>set myDb = OpenDatabase ("c:\db\wquality.mdb", FALSE, FALSE)

>newTable.Name = "wsys"
>newTable.Connect = "c:\db\landbase.mdb"
>newTable.SourceTableName = "water_system"

>myDb.TableDefs.Append newTable

>Exit Sub

>Upon executing the last line, I get an "Unable to find Installable ISAM"
>error. I know this error occurs when you have an invalid setting
>in the connect property for a data control but the documentation
>states that for a new TableDef object, this property should be set
>to the path of the database containing the table ( set in the
>SourceTableName property).

>Also, when I do this, will this keep the attachment permanent? Meaning,
>if I open the .mdb under Access, will I see the attachment created
>under VB? If not, how can keep the attachment permanent.

>If attaching a table at run time is not possible (The doc says that
>it is), I have one question for those of you who have delivered VB
>applications to customers with attached tables. Do you force the
>directory of the mdb files onto the user? (Not a good idea in my
>opinion) If not, how do you modify the attachments so the directories
>match? Let me give you an example:

>    On my computer
>    Database A
>            c:\db\keith.mdb
>    Table a_table1
>            located in keith.mdb
>    Table b_table1
>            attached from Database B

>    Database B

This problem usually occurs becaus you don't have the Installable ISAMS
section specified in your INI file.  The standard VB.INI has them in it but VB
want to find them in a file <PROGRAM>.INI.

To overcome this you can add them to your programs INI file or add the
following code to your program.

           Set DataAccessOption 1 "VB.INI"

Hope this helps..

Jeff Sinason


1. Attaching Access Table in external database

I have an Access 2.0 database and one of its tables is actually an
attached table in another Access 2.0 database (the attachment was done
with Access). How can I use it in VB? I have tried everything the manuals
say (and they don't say much at all) and nothing works. I can't use
"OpenTable" either.

The funny thing is that SQL queries work with this attached table just
fine. I can't, however, constract a Table object from it and use it like
all others.

What am I missing?

Thanks in advance!

Peter Antypas

2. $25 web pages/custom!!!!

3. Can't Access External Access Table

4. Newbie ? - Error 3050 "Couldn't lock file"

5. MS-Access: Attach external Btrieve files

6. GetRows faster with SELECT COUNT(*) ?

7. Regarding Accessing External database using MS-Access and MS-Visual Basic

8. N^2 (squared) problem on Mac with FM Developer 5.0

9. Access database with attached foxpro tables

10. Attaching a SQL Server table to an Access 2.0 database

11. Updating SQL60 database from a attached ACCESS table

12. Attached Tables in a multi-user ACCESS Database

13. How to attach tables to a readonly Access 2.0 database using VB