Article ID: 123714
Article Last Modified on 11/6/2000
Option Explicit
Function attach_all ()
Dim DB As Database
Dim RS As Recordset
Dim QD As QueryDef
Set DB = DBEngine.Workspaces(0).Databases(0)
' Set the QueryDef variable to the pass-through query.
Set QD = DB.OpenQueryDef("sql_tables")
Set RS = DB.OpenRecordset(QD.name, DB_OPEN_SNAPSHOT)
Do Until RS.EOF
DoCmd TransferDatabase A_ATTACH, "<Sql database>", _
QD.connect, A_TABLE, RS!Name, RS!Name
RS.MoveNext
Loop
RS.Close
QD.Close
End Function
Keywords: kbhowto kbusage KB123714