Microsoft KB Archive/210597

= ACC2000: How to Determine If a Form Exists in a Database =

Article ID: 210597

Article Last Modified on 6/23/2005

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q210597



Moderate: Requires basic macro, coding, and interoperability skills.



SUMMARY
This article shows you how to create a Visual Basic for Application procedure to determine if a form exists in a database. If the form is in the database, the function opens it; otherwise, you get a message box stating that the form does not exist in this database.



MORE INFORMATION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. Sub FormOpener(FormToOpen As String)

Dim obj As AccessObject For Each obj In CurrentProject.AllForms If obj.Name = FormToOpen Then DoCmd.OpenForm FormToOpen Exit Sub End If  Next MsgBox FormToOpen & " does not exist in this database." End Sub

