Group:  Microsoft Access ยป microsoft.public.access.odbcclientsvr
Thread: Connecting to Sybase

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Connecting to Sybase
Peter L Reader <preader[ at ]spammenot.pacifier.com> 27.10.2005 21:28:35
I'm trying to link to an Adaptive Server Anywhere 9.0 db in Access 2K
code:

Dim ConnectString As String, MyDB As DAO.Database, MyTDF As
DAO.TableDef
Dim LocalName As String, ForeignName As String
ConnectString = "Connect=ODBC;Database=GIDS;DSN=GIDSHome;"
LocalName = "dbo_TktRemarks"
ForeignName = "dbo.TktRemarks"
Set MyDB = CurrentDb
Set MyTDF = MyDB.CreateTableDef(LocalName, ForeignName, ConnectString)
MyDB.TableDefs.Append MyTDF


When I run this, I get a run-time error 3421, "Data type conversion
error" on the Set MyTDF statement. The connect string above is exactly
like connect property values for tables I successfully link using the
Get External Data wizard. According to the Sybase log, the request
never gets to the ASA server, so it must be getting stopped in Access
or ODBC.

Can anyone help with this?
Re: Connecting to Sybase
Philipp Stiefel <phil[ at ]codekabinett.de> 02.11.2005 10:39:47
Peter L Reader <preader[ at ]spammenot.pacifier.com> wrote:

[Quoted Text]
> I'm trying to link to an Adaptive Server Anywhere 9.0 db in Access 2K
> code:
>
> Dim ConnectString As String, MyDB As DAO.Database, MyTDF As
> DAO.TableDef
> Dim LocalName As String, ForeignName As String
> ConnectString = "Connect=ODBC;Database=GIDS;DSN=GIDSHome;"
> LocalName = "dbo_TktRemarks"
> ForeignName = "dbo.TktRemarks"
> Set MyDB = CurrentDb
> Set MyTDF = MyDB.CreateTableDef(LocalName, ForeignName, ConnectString)
> MyDB.TableDefs.Append MyTDF
>
>
> When I run this, I get a run-time error 3421, "Data type conversion
> error" on the Set MyTDF statement.

The order of arguments for CreateTableDef is:

CreateTableDef (name, attributes, source, connect)

You're passing "ForeignName" instead of the "attributes"-argument,
which is a Long. That causes the datatype conversion error.

HTH
Phil



Re: Connecting to Sybase
Peter L Reader <preaderno[ at ]spimmyspampacifier.com> 02.11.2005 15:10:30
On Wed, 2 Nov 2005 11:39:47 +0100, Philipp Stiefel
<phil[ at ]codekabinett.de> wrote:

[Quoted Text]
>Peter L Reader <preader[ at ]spammenot.pacifier.com> wrote:
>
>> I'm trying to link to an Adaptive Server Anywhere 9.0 db in Access 2K
>> code:
>>
>> Dim ConnectString As String, MyDB As DAO.Database, MyTDF As
>> DAO.TableDef
>> Dim LocalName As String, ForeignName As String
>> ConnectString = "Connect=ODBC;Database=GIDS;DSN=GIDSHome;"
>> LocalName = "dbo_TktRemarks"
>> ForeignName = "dbo.TktRemarks"
>> Set MyDB = CurrentDb
>> Set MyTDF = MyDB.CreateTableDef(LocalName, ForeignName, ConnectString)
>> MyDB.TableDefs.Append MyTDF
>>
>>
>> When I run this, I get a run-time error 3421, "Data type conversion
>> error" on the Set MyTDF statement.
>
>The order of arguments for CreateTableDef is:
>
>CreateTableDef (name, attributes, source, connect)
>
>You're passing "ForeignName" instead of the "attributes"-argument,
>which is a Long. That causes the datatype conversion error.
>
>HTH
>Phil
Oh!! I thought since the argument was optional, I could ignore it. But
I probably should have used a placeholder...I'll try this right away.
Thanks!

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net