Code for closing two forms on one click

C

Carl Mankat

I am using Access 2000 on W2K OS.

I want to close two forms and open a third form. The following code does
not close the FrmCombo0 form. The second DoCmd.Close works as does the
DoCmd.Openform. The current form is "Frm_Elementary_Phones"

Dim stDocName As String
Dim stLinkCriteria As String
DoCmd.Close acForm, "FrmCombo0"
DoCmd.Close acForm, "Frm_Elementary_Phones", acSaveNo


stDocName = "Elementary_Main"
DoCmd.OpenForm stDocName, , , stLinkCriteria


What am I doign incoorrectly that doesn't close two forms.

TIA,

Carl
 
R

Rick Brandt

Carl said:
I am using Access 2000 on W2K OS.

I want to close two forms and open a third form. The following code
does not close the FrmCombo0 form. The second DoCmd.Close works as
does the DoCmd.Openform. The current form is "Frm_Elementary_Phones"

Dim stDocName As String
Dim stLinkCriteria As String
DoCmd.Close acForm, "FrmCombo0"
DoCmd.Close acForm, "Frm_Elementary_Phones", acSaveNo


stDocName = "Elementary_Main"
DoCmd.OpenForm stDocName, , , stLinkCriteria


What am I doign incoorrectly that doesn't close two forms.

Should work. Do you get an error? Are you sure you spelled the name of the
form correctly?
 
C

Carl Mankat

I can't see any misspelled terms and I get no Error message. Here is the
complete code does anyone see anything:

Private Sub Command35_Click()
On Error GoTo Err_Command35_Click

Dim stDocName As String
Dim stLinkCriteria As String
DoCmd.Close acForm, "FrmCombo0"
DoCmd.Close acForm, "Frm_Elementary_Phones", acSaveNo


stDocName = "Elementary_Main"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command35_Click:
Exit Sub

Err_Command35_Click:
MsgBox Err.Description
Resume Exit_Command35_Click

End Sub

TIA,

Carl
 

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

Similar Threads


Top