-
How to create MS Access linked table with VB5/6 DAO/SQL
How do you create a linked table(formerly called attached) for MS Access using
DAO and/or DDL (SQL), from within VB 5 or 6 ?
-
Re: How to create MS Access linked table with VB5/6 DAO/SQL
"Yong Hu" <yong@informer911.com> wrote:
>
>How do you create a linked table(formerly called attached) for MS Access
using
>DAO and/or DDL (SQL), from within VB 5 or 6 ?
>
>
-
Re: How to create MS Access linked table with VB5/6 DAO/SQL
"Yong Hu" <yong@informer911.com> wrote:
>
>How do you create a linked table(formerly called attached) for MS Access
using
>DAO and/or DDL (SQL), from within VB 5 or 6 ?
>
>
Private Sub TestLink()
Dim db As Database
Dim tdf As TableDef
Dim sPath As String
sPath = "C:\progra~1\microsoft visual studio\vb98\"
Set db = DBEngine.OpenDatabase(sPath & "nwind.mdb")
Set tdf = db.CreateTableDef("testlink")
tdf.Connect = ";DATABASE=" & sPath & "biblio.mdb"
tdf.SourceTableName = "authors"
db.TableDefs.Append tdf
db.Close
Set db = Nothing
End Sub
Obviously add error trapping and validation
-Jason
-
Re: How to create MS Access linked table with VB5/6 DAO/SQL
Can't be done with DAO or DDL. I recently did this, but I had to use a DoCmd
method. I forget the method; I think it was GetDatabase or something like
that. Whatever it is you can load the Access object library and create the
links from VB5 or 6.
"Yong Hu" <yong@informer911.com> wrote:
>
>How do you create a linked table(formerly called attached) for MS Access
using
>DAO and/or DDL (SQL), from within VB 5 or 6 ?
>
>
-
Re: How to create MS Access linked table with VB5/6 DAO/SQL
"Tim" none wrote:
>
>Can't be done with DAO or DDL.
Yeah, it can. See my post. I do it all the time.
> I recently did this, but I had to use a DoCmd
>method. I forget the method; I think it was GetDatabase or something like
>that. Whatever it is you can load the Access object library and create
the
Use DAO, not the Access object library. Two reasons. One, the overhead for
creating the Access object and working through Access is huge. Second, if
this is a distributed app you don't want to have to distribute Access to
all your clients. DAO is big enough.
>links from VB5 or 6.
>
>"Yong Hu" <yong@informer911.com> wrote:
>>
>>How do you create a linked table(formerly called attached) for MS Access
>using
>>DAO and/or DDL (SQL), from within VB 5 or 6 ?
>>
>>
>
-
re: linking tables programmatically in DAO
Pardon this bit of thread necromancy, but I'm only just now getting around to messing with Access in VB 6.0. (Prior experience has all been against SQL Server.)
I've got similar code to the examples provided above, but whenever I set the .Connect property on any table def, I get an "Invalid operation" error immediately. (Same occurs if I skip the .Connect property and attempt to do a .Refresh instead.)
Why does the .Connect property allow setting at some times, and not at others? Is this perhaps a consequence of the .Properties settings? What do I need to do to get the code to work?
Thanks in advance!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|