Search code examples
vbauserform

Going Back and forth between Userforms


Hello everyone on my userfrom I have a previous and a next button the previous button on userform 1 contains a next button which the code looks something like this

userform1.hide
userform2.show

on userform 2 I have a previous button that looks like this

userform2.hide
userform1.show

but when I go back to userform1 and foreward to userform 2 I get an error message that states this.

run-time error '400':

Form already displayed; can't show modally.

is there anyway I can fix this or create an if statement to help I am lost right now. Thanks for any help


Solution

  • Hide first, then show.

    userform1.Hide
    userform2.Show
    

    Also, within the form, you could say ME:

    Me.Hide
    UserForm2.Show