We have a old VBA app that create 3 linked tables to SQL server.
However for whatever reason now whenever the code tries to create these
linked tables, a dialog box comes up prompting for a server name and
with the username and password already filled. Anyone know why these
dialog boxes are coming up? 3 linked tables means 3 prompts. Is there a
problem with the DSN?
Here is the code that creates the problems:
sConnect = "ODBC;Driver={SQL Server};Database=" + sDB + ";" & "UID=" +
sUID & ";" & "PWD=" & sPWD & ";" & "DSN=" & sDSN
Set tblTableDef = CurDb.CreateTableDef("NextAvailableCode")
tblTableDef.Connect = sConnect
tblTableDef.SourceTableName = "NextAvailableCode"
CurDb.TableDefs.Append tblTableDef 'dialog box comes up here
Set tblTableDef = CurDb.CreateTableDef("IndustryClass")
tblTableDef.Connect = sConnect
tblTableDef.SourceTableName = "IndustryClass"
CurDb.TableDefs.Append tblTableDef 'dialog box comes up here
Set tblTableDef = CurDb.CreateTableDef("OtherClass")
tblTableDef.Connect = sConnect
tblTableDef.SourceTableName = "OtherClass"
CurDb.TableDefs.Append tblTableDef 'dialog box comes up here