By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,197 Members | 1,173 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,197 IT Pros & Developers. It's quick & easy.

Too many Forms Open

P: n/a
I am a complete newbie with no code experience. I have a form that acts
as a switchboard. When I click on a button to open a new form, the old
form remains open. This can go on for a few levels and before you no
it, there are 6 or 7 forms open. I would like to be able to click to
open a new form and the old form close automatically. If someone can
either explain modules or code to do this in simple terms, that would
be great. Is this something I will have to program for each command
button individually?

rbp1976

Nov 13 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
docmd.close "<switchboard form>" right after the open command will
close the current form

Nov 13 '05 #2

P: n/a
docmd.close <formname in quotes> right after the command to open the
new form

Nov 13 '05 #3

P: n/a
Ozzone wrote:
docmd.close "<switchboard form>" right after the open command will
close the current form


Would this go as an [Event Procedure] in the "OnClick" properties of
the command button to open the new form (where the ... is?)? These
groups would be nice if you could attach screen shots to visually
explain.

Nov 13 '05 #4

P: n/a
This is the current code:

Private Sub Team_1_menu_Click()
On Error GoTo Err_Team_1_menu_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Team 1 Menu"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Team_1_menu_Click:
Exit Sub

Err_Team_1_menu_Click:
MsgBox Err.Description
Resume Exit_Team_1_menu_Click

End Sub
This is how I think I'm supposed to do it:

Private Sub Team_1_menu_Click()
On Error GoTo Err_Team_1_menu_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Team 1 Menu"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.CloseForm "Training Main Menu"

Exit_Team_1_menu_Click:
Exit Sub

Err_Team_1_menu_Click:
MsgBox Err.Description
Resume Exit_Team_1_menu_Click

End Sub

Didn't work!

Nov 13 '05 #5

P: n/a
Figured it out;

Private Sub Training_Main_menu_Click()

'open training main menu
DoCmd.OpenForm "Training Main Menu"
'Close team 1 menu form
DoCmd.Close acForm, "Team 1 Main Menu"

End Sub

Very simple. I just don't have error code left.

Nov 13 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.