Gustav Brock
gustav at cactus.dk
Sun Sep 19 09:56:09 CDT 2004
Hi Brett > Try setting tdAttach.Attributes = dbAttachSavePWD First, I think this is for attached Jet databases only. Second, I guess this should be: tdAttach.Attributes = tdAttach.Attributes Or dbAttachSavePWD or you would kill any other attribute (or raise an error). Also, this should not be necessary: > Do Until rs.EOF > Debug.Print rs!Name > Set tdf = db.CreateTableDef(rs!Name) > > tdf.Connect = "ODBC;" & _ > ExtractArg(rs!Connect, "DRIVER") & ";" & _ > "SERVER=" & strServer & ";" & _ > ExtractArg(rs!Connect, "DATABASE") & ";" & _ > "UID=" & strUID & ";" & _ > "PWD=" & strPWD > > tdf.Attributes = dbAttachSavePWD > tdf.SourceTableName = rs!ForeignName > db.TableDefs.Delete rs!Name > db.TableDefs.Append tdf > > rs.MoveNext > Loop A Refresh is normally fine (and faster): Set tdf = db.TableDefs(rs!Name) tdf.Connect = "ODBC;" & _ ... tdf.Attributes = dbAttachSavePWD tdf.SourceTableName = rs!ForeignName tdf.Refresh /gustav > I'm using a similar routine currently. I have a metadata table full of > information about the data tables. It contains the localname, path and > sourceobject name of the table I'm linking to in SQL Server. > The actual linking is fine, but as you said remembering the password is > an issue.