
Attaching External Access Table to Access Database
Quote:
>Hello,
>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