Partial code (see text also)
Set Rs = Db.OpenRecordset("SELECT NAME, TYPE FROM
USysObjects",DAO.DbOpenSnapshot)
While Not Rs.EOF
Select Case Rs.Fields("Type").Value
Case thTable
Set Cont = Db.Containers("Tables")
Set Doc = Cont.Documents(Rs.Fields("Name").Value)
ObjType = GetObjType(Cont.Name)
Case thQuery
Set Cont = Db.Containers("Tables")
Set Doc = Cont.Documents(Rs.Fields("Name").Value)
ObjType = GetObjType("Queries")
End Select
Access.Application.DoCmd.TransferDatabase
Access.AcDataTransferType.acExport, "Microsoft Access", ToDb.Name, ObjType,
Doc.Name, Doc.Name
'...
Wend
HtH
Pieter
WANNABE said:
Thank you Pieter. I can follow a little of this, but I get lost un a few
places... PLEASE see questions/comments in text..
Building on the Code I gave you earlier today you can make a table
containing 2 Fields: Name & Type From MSysObjects
You can then delete all unwanted object references from this table.
method 1 is closest with respect to how to do it, method 2 comes into play
with regards to the "how"
FIELDNAME FOR NAME IN THE NEW TABLE? Neither, see later
You can use this function to convert container name to the ObjectType as
METHOD 1 OR 2? No, Example last
used by DoCmd.TransferDatabase (a.o)
Note: This Does not distinguish between Tables & Queries
The container names are Tables, Forms, Reports, Modules & Macros
Private Function GetObjType(ContName As String) As Access.AcObjectType
' There's no container named Queries - so this requires that the object
is
typechecked for this to return the correct object type
On Local Error Resume Next
Select Case ContName
Case "Tables":
GetObjType = Access.AcObjectType.acTable
Case "Scripts":
GetObjType = Access.AcObjectType.acMacro
Case "Forms":
GetObjType = Access.AcObjectType.acForm
Case "Modules":
GetObjType = Access.AcObjectType.acModule
Case "Queries":
GetObjType = Access.AcObjectType.acQuery
Case "Reports":
GetObjType = Access.AcObjectType.acReport
End Select
End Function
+ yes, these are the actual msysobject types