Storing queries

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have multiple clients that have an MDB. The MDB has the same tables but
some of the queries, reports and macros are different. I'd like to create
one master database with all the objects. Do you have any suggestions on the
best way to organize this mess?
 
well, it's your life <g>

Sub GetQueries()
Dim TDb As DAO.Database, FDb As DAO.Database
Dim TQd As DAO.QueryDef, FQd As DAO.QueryDef

Set TDb = Access.CurrentDb
Set FDb = Access.DBEngine.Workspaces(0).OpenDatabase("C:\Data\Db.mdb")
For Each FQd In FDb.QueryDefs
On Error Resume Next
Set TQd = TDb.QueryDefs(FQd.Name)
On Error GoTo 0
If TQd Is Nothing Then
Access.DoCmd.TransferDatabase acImport, "Microsoft Access", FDb.Name,
acQuery, FQd.Name, FQd.Name
Else
Set TQd = Nothing
End If
Next
FDb.Close: Set FDb = Nothing
Set TDb = Nothing

End Sub

Pieter
 
You paste it into a General module, Put the cursor somewhere in the code &
hit F5

HTH

Pieter
 
Back
Top