JARE,
The following 'works for me'.
You do need to "link" the "MasterDB" MSysObjects into the "Slave" datbases (it is the [MSysObjects1] table. in the query)
I have NOT tested this thoroughly, so you may need to adjust some of the criteria calculation (e.g. the dates), however it DOES copy the objects from an external (MS Access) db to the current (MS Access) db, based on the recordset generated by the SQL statement.
I have used the "hidden" system table (MSysObjects) to get the list, however there are other mechanisims which could achieve the same result. Also, I have chosen to generate the recordset of the objects to transfer via the Querydef/Sql statement while other methods may be more appropiate, however this allows me to show the entire process in a single module, rather than showing SQL statements seperatly.
Public Function basUpdateMDB()
'Function to Check the "Master" MDB and update the Local
'copy of Forms, Modules and Reports where the Date/Time
'stamp of the Local is NOT the same as the Master
Dim dbs As Database
Dim MastDbs As Database
Dim rst As Recordset
Dim qdf As QueryDef
Dim MyType As Integer
Dim strSQL As String
Set dbs = CurrentDb
Set MastDbs = DBEngine.Workspaces(0).OpenDatabase("C:\My Documents\BksByPubl.MDB"
strSQL = "SELECT DISTINCTROW "
strSQL = strSQL & "[MSysObjects1].[DateUpdate]>IIf(IsNull([MSysObjects].[DateUpdate]),0,[MSysObjects].[DateUpdate]) AS New, "
strSQL = strSQL & "MSysObjects1.Name, MSysObjects1.Type "
strSQL = strSQL & "FROM MSysObjects1 "
strSQL = strSQL & "LEFT JOIN MSysObjects ON (MSysObjects1.Name = MSysObjects.Name) AND "
strSQL = strSQL & "(MSysObjects1.DateUpdate = MSysObjects.DateUpdate) "
strSQL = strSQL & "WHERE (((MSysObjects1.Type)=-32761) AND "
strSQL = strSQL & "(([MSysObjects1].[DateUpdate]>IIf(IsNull([MSysObjects].[DateUpdate]),0,[MSysObjects].[DateUpdate]))=True) "
strSQL = strSQL & "AND "
strSQL = strSQL & "(([MSysObjects1].[DateUpdate]>IIf(IsNull([MSysObjects].[DateUpdate]),0,[MSysObjects].[DateUpdate]))=True) "
strSQL = strSQL & "AND ((MSysObjects.DateUpdate) Is Null)) OR "
strSQL = strSQL & "(((MSysObjects1.Type)=-32768) AND "
strSQL = strSQL & "(([MSysObjects1].[DateUpdate]>IIf(IsNull([MSysObjects].[DateUpdate]),0,[MSysObjects].[DateUpdate]))=True) "
strSQL = strSQL & "AND ((MSysObjects.DateUpdate) Is Null));"
Set qdf = dbs.CreateQueryDef("", strSQL)
Set rst = dbs.OpenRecordset(strSQL)
While Not rst.EOF
Select Case rst!Type
Case Is = -32761
MyType = acModule
Case Is = -32764
MyType = acReport
Case Is = -32768
MyType = acForm
End Select
DoCmd.TransferDatabase acImport, "Microsoft Access", _
MastDbs.Name, MyType, rst!Name, rst!Name
rst.MoveNext
Wend
End Function
[sig]<p>MichaelRed<br><a href=mailto:mred@duvallgroup.com>mred@duvallgroup.com</a><br>There is never time to do it right but there is always time to do it over[/sig]