Command buttons to switch between forms

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.
 
W

Wayne-I-M

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
 
G

GD

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
 
W

Wayne-I-M

I am glad it worked.

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

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