Returning control or focus to an open form (2002)

T

TIm Rush

Below is my procedure for returning focus to an open form. I get the
following error: “Run-time error ‘2467’: The expression you entered refers to
an object that is closed or does not exist. “
The form is open when this happens. ( I’ve added traps after the isloaded
check to return a msgbox response if found and open.).
Using A2002.

This takes a button click from one menu form page, closes it, and returns
control to the main menu page. (These pages replace the switchboard).
Private Sub Return_Click()
DoCmd.Close acForm, Me.Name ‘Close this menu
If IsLoaded("pgMain") Then ‘Check for main menu
Forms![pgMain].SetFocus ‘show main menu if open
Else
DoCmd.OpenForm "pgMain", acNormal ‘main menu was closed
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top