Hi, i am having a problem on my program

Private Sub Command1_Click()
If text1.Text = "" Then
MsgBox ("You have no content on your 1st Textbox")
Else
End If
.
.
.
Bunch of codes that will result to an error if there is no value for text1.text

When the user clicks the command button and the textbox is blank, there will be a msgbox popping out.

But how can i make the program go back to the form1 without continuing the program since there would be errors after the first if statement

To "Exit Sub" so nothing else happens but before this you may want to "SetFocus"...

Use Exit Sub so the rest of the code does not execute after your message box and if you want use Text1.SetFocus to make it easy for your user to enter information...

Good Luck

Hi,
I think you have almost done that.

Private Sub Command1_Click()
If text1.Text = "" Then
MsgBox ("You have no content on your 1st Textbox")
Else
form1.Show
End If

Hope this helps

so..you on form2 and after msg u want to back to form1?right?
so just showing form 1 after message..

Private Sub Command1_Click()

If Text1.Text = "" Then

MsgBox ("You have no content on your 1st Textbox")
Form1.Show
Unload Me
Else

End If
End Sub

so..you on form2 and after msg u want to back to form1?right?
so just showing form 1 after message..

Private Sub Command1_Click()

If Text1.Text = "" Then

MsgBox ("You have no content on your 1st Textbox")
Form1.Show
Unload Me
Else

End If
End Sub
Private Sub Command1_Click()

If Text1.Text = "" Then

MsgBox ("You have no content on your 1st Textbox")
Form1.Show
form2.hide
Unload Me
Else

End If
End Sub

i just added form2.hide :)

This question has already been answered. Start a new discussion instead.