Command buttons to switch between forms

  • Thread starter Thread starter GD
  • Start date Start date
G

GD

I'm trying to use a command button on each of 2 forms to enable the user to
switch back and forth and the click of a button. The code I'm using is:

Private Sub GoToCMDM_Click()
DoCmd.OpenForm "frmCMDMSearch", acNormal
DoCmd.Close acForm, "frmCMLabelsDataEntry", acSaveNo

End Sub

Private Sub GoToCMLabels_Click()
DoCmd.OpenForm "frmCMLabelsDataEntry", acNormal
DoCmd.Close acForm, "frmCMDMSearch", acSaveNo
End Sub

It works once for each, but then stops working. And the code for the form
that it stops on changes to:

Private Sub GoToCMDM_Click()

End Sub

Private Sub GoToCMLabels_Click()
DoCmd.OpenForm "frmCMDMSearch", acNormal
DoCmd.Close "frmCMLabelsDataEntry"
End Sub

What am I doing wrong? I'm new at this.
 
Private Sub GoToCMDM_Click()
DoCmd.OpenForm "frmCMDMSearch", acNormal, "", "", , acNormal
DoCmd.Close acForm, "frmCMLabelsDataEntry"
End Sub


Private Sub GoToCMLabels_Click()
DoCmd.OpenForm "frmCMLabelsDataEntry", acNormal, "", "", , acNormal
DoCmd.Close acForm, "frmCMDMSearch"
End Sub
 
Works great!! Thanks, Wayne!

--
GD


Wayne-I-M said:
Private Sub GoToCMDM_Click()
DoCmd.OpenForm "frmCMDMSearch", acNormal, "", "", , acNormal
DoCmd.Close acForm, "frmCMLabelsDataEntry"
End Sub


Private Sub GoToCMLabels_Click()
DoCmd.OpenForm "frmCMLabelsDataEntry", acNormal, "", "", , acNormal
DoCmd.Close acForm, "frmCMDMSearch"
End Sub
 
I am glad it worked.

Happy Christmas from a "very" snowy (2m in the last week) Northern Italy
 
Back
Top