' Return a form by name if it is loaded.
Private Function FindForm(ByVal form_name As String) As Form Dim i As Integer ' Assume we will not find it. Set FindForm = Nothing ' Search the loaded forms. For i = 0 To Forms.Count - 1 If Forms(i).Name = form_name Then ' We found it. Return this form. Set FindForm = Forms(i) Exit For End If Next i End Function |