Set Report Pproperties

PC User

Registered User.
Local time
Today, 11:42
Joined
Jul 28, 2002
Messages
193
I’m trying to globally change some of the properties of all my reports and I can’t get the code to work. Can someone advise me on this. See below. I get an error on the obj. ==>> Compile Error: Invalid Qualifier.
===================================================
Public Function SetReportProperties()
Dim obj As AccessObject
Dim dbs As Object
Set dbs = Application.CurrentProject
For Each obj In dbs.AllReports
obj.DefaultView = 1
obj.Popup = True
Next obj
End Function
===================================================
Thanks,
PC
 
mostly you have to programtaically open the report in design mode, code the change and then save it. You cant change most of these things at run time
 
Comments are welcome, but solutions are preferred. In fact, tested code proves to be the best answer. It is possible, because someone who knew the answer did help me. See code below.
Code:
Public Function ChangeReports()
   Dim db As Database, c As Container, d As Document, r As Report
   Set db = CurrentDb
   Set c = db.Containers("Reports")
   For Each d In c.Documents
      DoCmd.OpenReport d.NAME, acViewDesign
      Set r = Reports(d.NAME)
      r.DefaultView = 1
      r.PopUp = True
      DoCmd.Close acReport, d.NAME, acSaveYes
   Next d
End Function
Thanks,
PC
 

Users who are viewing this thread

Back
Top Bottom