I have two versions of a database front end and want to be able to use
docmd.copy (or some other method) to move a bunch of queries.
I was able to use the '.tag' property to of forms and reports to move
them using code. For example, first I put the word "Special" in the
..tag property of my reports (or forms), then I use the following
procedure:
Sub CopyReps()
Dim db As Database
Dim con As Container
Dim doc As Document
Dim rpt As Report
Dim strReportName As String
Set db = CurrentDb
Set con = db.Containers("Reports")
For Each doc In con.Documents
strReportName = doc.Name
DoCmd.OpenReport strReportName, acViewDesign
Set rpt = Reports(strReportName)
If rpt.Tag = "Special" Then
DoCmd.CopyObject "DestinationDatabase.mdb", strReportName ,
acReport, strReportName
End If
DoCmd.Close acReport, strReportName
Set rpt = Nothing
Next doc
End Sub
I know this isn't very elegant, but it seems to work. Is a way to do
the same with queries. I have a dozen or so 'special 'queries buried
in the 600 some odd queries in my application and would love to be
able to move them in one fell swoop whenever I update my front end.
Is there some property of queries I can tag so that my code can find
and move them? Should I take a different strategy? For example, is
there a way to use code to address the members of a 'Group' in the
database window?
Thanks in advance for the help!
Jim