<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: close code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Fri, 29 Aug 2008 12:55:58 GMT</pubDate>
    <description>DZone Snippets: close code</description>
    <item>
      <title>Close all forms in Access</title>
      <link>http://snippets.dzone.com/posts/show/3911</link>
      <description>Sometimes, it's necessary to close all forms in a single procedure:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;Function CloseAllForms()&lt;br /&gt;&lt;br /&gt;'It will close all forms before opening the new form (if required)&lt;br /&gt;&lt;br /&gt;Dim obj As Object&lt;br /&gt;Dim strName As String&lt;br /&gt;&lt;br /&gt;For Each obj In Application.CurrentProject.AllForms&lt;br /&gt;DoCmd.Close acForm, obj.name, acSaveYes&lt;br /&gt;Next obj&lt;br /&gt;&lt;br /&gt;End Function&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Close all forms - except one particular screen:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;Function CloseAllForms()&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Dim obj As Object&lt;br /&gt;Dim strName As String&lt;br /&gt;&lt;br /&gt;For Each obj In Application.CurrentProject.AllForms&lt;br /&gt;&lt;br /&gt;If obj.Name &lt;&gt; "Your Form" Then &lt;br /&gt;&lt;br /&gt;DoCmd.Close acForm, obj.name, acSaveYes&lt;br /&gt;&lt;br /&gt;End if &lt;br /&gt;Next obj&lt;br /&gt;&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 26 Apr 2007 17:56:19 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3911</guid>
      <author>melissa68 (Melissa )</author>
    </item>
  </channel>
</rss>
