just use the SetFocus method to bring the form to the front.
You'd need to loop through the Forms collection to do what you want...paste this into a module
VB Code:
Public Function FrmFocus(frmCaption As String) As Integer
' Inputs: Form caption
' output: 1 form found, 0 form not found
Dim frm As Form
For Each frm In Forms
If frm.Caption = frmCaption Then
'match found, set focus
frm.SetFocus
FrmFocus = 1
Exit Function
End If
Next frm
' not found!
FrmFocus = 0
End Function
Usage...
VB Code:
Private Sub Command2_Click()
Dim intReturn As Integer
intReturn = FrmFocus("Form4")
If intReturn = 0 Then MsgBox "Form 4 not found!", vbCritical
End Sub