DSNLess link table

G

Ghost Dog

The Microsoft example at
http://support.microsoft.com/default.aspx?scid=kb;EN-US;892490 doesn't work

Function AttachDSNLessTable(stLocalTableName As String, stRemoteTableName As
String, stServer As String, stDatabase As String)
On Error GoTo AttachDSNLessTable_Err
Dim td As TableDef
Dim stConnect As String
For Each td In CurrentDb.TableDefs
If td.Name = stLocalTableName Then
CurrentDb.TableDefs.Delete stLocalTableName
End If
Next
stConnect = "ODBC;DRIVER=SQL Server;SERVER=" & stServer & ";DATABASE=" &
stDatabase & ";Trusted_Connection=Yes"
Set td = CurrentDb.CreateTableDef(stLocalTableName, dbAttachSavePWD,
stRemoteTableName, stConnect)
CurrentDb.TableDefs.Append td
AttachDSNLessTable = True
Exit Function

AttachDSNLessTable_Err:
AttachDSNLessTable = False
End Function


I get a data type conversion error when I use the above MS code snippet.
What is dbAttachSavePWD? It is not declared or defined
in the link at
http://support.microsoft.com/default.aspx?scid=kb;EN-US;892490

P.S. I removed the optional stuff as it is not pertinent.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top