ADOX link to Access.MDE problem!!

ADOX link to Access.MDE problem!!

Post by John C. Hil » Thu, 17 Feb 2000 04:00:00



I am trying to create a link to a Access 2000 mde database, and connect to
one table.

The following code works fine, until I execute the "cat.Tables.Append tbl"
statement.  At this point, I get know error, But the focus returns to the
form that called the function, and then I get a general protection fault
error.  I have tried this with Win2K and NT 4.0 sp6.

Any help would be greatly appreciated!!

Thanks,

John

Public Function LinkToAccess(strDBName As String, strTableName As String,
strAccessTable As String)
    'This function will attempt to attach/link a passed table name
    ' from another access db table to the current db.  It will return 0 for
ok, 1 for error
    LinkToAccess = 0
    On Error GoTo LinkToAccess_BadLink
    'Now creat the link to the database and table that were passed
    Dim cat As ADOX.Catalog
    Dim tbl As ADOX.Table

    Set cat = New ADOX.Catalog
    cat.ActiveConnection = CurrentProject.Connection

    Set tbl = New ADOX.Table
    tbl.Name = strAccessTable
    Set tbl.ParentCatalog = cat

    tbl.Properties("jet OLEDB:Create Link") = True
    tbl.Properties("Jet OLEDB:Link Datasource") = strDBName
    tbl.Properties("Jet OLEDB:Link Provider String") = ";pwd=wuvuth]]"
    tbl.Properties("jet oledb:Remote Table Name") = strTableName

    cat.Tables.Append tbl

End_LinkToAccess:
    Exit Function

LinkToAccess_BadLink:
    MsgBox Err.Description
    LinkToAccess = 1
    GoTo End_LinkToAccess

End Function

 
 
 

ADOX link to Access.MDE problem!!

Post by mary chipma » Fri, 18 Feb 2000 04:00:00


even if you succeed in linking tables using ADOX, the tables will be
read-only. use DAO instead.



Quote:>I am trying to create a link to a Access 2000 mde database, and connect to
>one table.

>The following code works fine, until I execute the "cat.Tables.Append tbl"
>statement.  At this point, I get know error, But the focus returns to the
>form that called the function, and then I get a general protection fault
>error.  I have tried this with Win2K and NT 4.0 sp6.

>Any help would be greatly appreciated!!

>Thanks,

>John

>Public Function LinkToAccess(strDBName As String, strTableName As String,
>strAccessTable As String)
>    'This function will attempt to attach/link a passed table name
>    ' from another access db table to the current db.  It will return 0 for
>ok, 1 for error
>    LinkToAccess = 0
>    On Error GoTo LinkToAccess_BadLink
>    'Now creat the link to the database and table that were passed
>    Dim cat As ADOX.Catalog
>    Dim tbl As ADOX.Table

>    Set cat = New ADOX.Catalog
>    cat.ActiveConnection = CurrentProject.Connection

>    Set tbl = New ADOX.Table
>    tbl.Name = strAccessTable
>    Set tbl.ParentCatalog = cat

>    tbl.Properties("jet OLEDB:Create Link") = True
>    tbl.Properties("Jet OLEDB:Link Datasource") = strDBName
>    tbl.Properties("Jet OLEDB:Link Provider String") = ";pwd=wuvuth]]"
>    tbl.Properties("jet oledb:Remote Table Name") = strTableName

>    cat.Tables.Append tbl

>End_LinkToAccess:
>    Exit Function

>LinkToAccess_BadLink:
>    MsgBox Err.Description
>    LinkToAccess = 1
>    GoTo End_LinkToAccess

>End Function


 
 
 

ADOX link to Access.MDE problem!!

Post by John C. Hil » Fri, 18 Feb 2000 04:00:00


Thanks Mary,

I'll rewrite, I was under the impression Microsoft wanted us to move to
ADO!!.  As usual, about the time you figure out one data access method, they
buid another one, but don't give you the same
functionality you had before!!

John


> even if you succeed in linking tables using ADOX, the tables will be
> read-only. use DAO instead.



> >I am trying to create a link to a Access 2000 mde database, and connect
to
> >one table.

> >The following code works fine, until I execute the "cat.Tables.Append
tbl"
> >statement.  At this point, I get know error, But the focus returns to the
> >form that called the function, and then I get a general protection fault
> >error.  I have tried this with Win2K and NT 4.0 sp6.

> >Any help would be greatly appreciated!!

> >Thanks,

> >John

> >Public Function LinkToAccess(strDBName As String, strTableName As String,
> >strAccessTable As String)
> >    'This function will attempt to attach/link a passed table name
> >    ' from another access db table to the current db.  It will return 0
for
> >ok, 1 for error
> >    LinkToAccess = 0
> >    On Error GoTo LinkToAccess_BadLink
> >    'Now creat the link to the database and table that were passed
> >    Dim cat As ADOX.Catalog
> >    Dim tbl As ADOX.Table

> >    Set cat = New ADOX.Catalog
> >    cat.ActiveConnection = CurrentProject.Connection

> >    Set tbl = New ADOX.Table
> >    tbl.Name = strAccessTable
> >    Set tbl.ParentCatalog = cat

> >    tbl.Properties("jet OLEDB:Create Link") = True
> >    tbl.Properties("Jet OLEDB:Link Datasource") = strDBName
> >    tbl.Properties("Jet OLEDB:Link Provider String") = ";pwd=wuvuth]]"
> >    tbl.Properties("jet oledb:Remote Table Name") = strTableName

> >    cat.Tables.Append tbl

> >End_LinkToAccess:
> >    Exit Function

> >LinkToAccess_BadLink:
> >    MsgBox Err.Description
> >    LinkToAccess = 1
> >    GoTo End_LinkToAccess

> >End Function

 
 
 

1. Linked SQL Server tables from Access mde

I have an Access front-end with tables linked to SQL Server 7.0.  I am
able to process the application code from my Access .mdb front-end, but
when I convert this .mdb into an .mde, I run into the following
error: "Couldn't execute query; couldn't find linked table."  Has
anyone had similar issues going from an mdb to an mde?

Thanks, Kim

Sent via Deja.com http://www.deja.com/
Before you buy.

2. Error using T-SQL debugger

3. ADOX : Linking Access and SQL Server leaves Access read only

4. Simple question: java.sql.Date and Escape formatting

5. ADOX and Access linked tables

6. Can I use the JDBC app driver to connect to a db on another machine?

7. ADOX and Access Linked Tables

8. Changing codepage of a DBF file

9. Re-linking Access tables with ADOX

10. ADOX and Access Linked Tables

11. ADOX Indexes on Access Linked Tables...

12. ADO Linking Databases/Tables - VB6 & .mde

13. Application Role, invoking sp_setapprole from a Client Access MDE