Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I make changes to forms/report via code?

Status
Not open for further replies.

dirkg

Technical User
May 20, 2000
170
BE
Hi all,<br><br>does anyone know how I can make changes to the design of a form/report via code without having to open the form/report (at least without making it visible to the user?)<br><br>Thank you very much in advance for your help.<br><br>Greetings,<br><br>Dirk<br><br><A HREF="mailto:dirk.news@yucom.be">dirk.news@yucom.be</A><br>
 
You can do this by looping through the Documents collection, getting the form names, then using docmd.openform...acdesign, etc.<br><br>Dim i As Integer,db as database<br>Set db = CurrentDb<br>For i = 0 To db.Containers(&quot;Forms&quot;).Documents.Count - 1<br>&nbsp;&nbsp;&nbsp;&nbsp;Set d = db.Containers(&quot;Forms&quot;).Documents(i)<br>&nbsp;&nbsp;&nbsp;&nbsp;DoCmd.OpenForm d.Name, acDesign, , , , acHidden<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>Next i<br><br>This opens all forms in design (you can change the code to open the one or ones you want), from here you can refer to them through the Forms collection, and change them at will.<br>--Jim
 
Jim,<br><br>thanks for your reply. It works for a form but with the OpenReport-method I can't use the windowmode acHidden. Do you know how I can do the same for a report?<br><br>Thank you very much in advance!<br><br>Greetings,<br><br>Dirk<br><br><A HREF="mailto:dirk.news@yucom.be">dirk.news@yucom.be</A>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top