1030071002
asked on
vb6 how do you return to a form
The user enters bad data I bring up the messagebox saying bad data please enter the correct data how do I return to the form so that the user can enter the correct data exit sub did not work return did not work how do i do this in vb6
I don't understand. VB6 forms keep staying until you unload them (manually or by code).
I don't understand. VB6 forms keep staying until you unload them (manually or by code).
Show (the code) how you are bringing up the messagebox when you detect bad data
ASKER
Private Sub cmd_save_Click()
Set fso = CreateObject("Scripting.Fi leSystemOb ject")
If cmb_doc_type.Text = "" Or IsNull(cmb_doc_type.Text) Then
MsgBox "Please Select a Document Type", vbCritical, "Error..."
cmb_doc_type.SetFocus <-- setting focus to the document type
End If
end sub
Set fso = CreateObject("Scripting.Fi
If cmb_doc_type.Text = "" Or IsNull(cmb_doc_type.Text) Then
MsgBox "Please Select a Document Type", vbCritical, "Error..."
cmb_doc_type.SetFocus <-- setting focus to the document type
End If
end sub
Your code seems to be working for me.
I created a new project, dropped a command button on the form (default name "Command1") and a combo box (default name "Combo1") then paste the following code into the form's code.
I've got VB6 SP6
I created a new project, dropped a command button on the form (default name "Command1") and a combo box (default name "Combo1") then paste the following code into the form's code.
I've got VB6 SP6
Private Sub Command1_Click()
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
If Combo1.Text = "" Or IsNull(Combo1.Text) Then
MsgBox "Please Select a Document Type", vbCritical, "Error..."
Combo1.SetFocus
End If
End Sub
ASKER
make sure you several combo box check in place and see what happen
Private Sub Command1_Click()
Dim fso As Object
Set fso = CreateObject("Scripting.Fi leSystemOb ject")
If Combo1.Text = "" Or IsNull(Combo1.Text) Then
MsgBox "Please Select a Document Type", vbCritical, "Error..."
Combo1.SetFocus
End If
If Combo2.Text = "" Or IsNull(Combo2.Text) Then
MsgBox "Please Select a Document Type", vbCritical, "Error..."
Combo2.SetFocus
End If
If Combo3.Text = "" Or IsNull(Combo3.Text) Then
MsgBox "Please Select a Document Type", vbCritical, "Error..."
Combo3.SetFocus
End If
End Sub
Private Sub Command1_Click()
Dim fso As Object
Set fso = CreateObject("Scripting.Fi
If Combo1.Text = "" Or IsNull(Combo1.Text) Then
MsgBox "Please Select a Document Type", vbCritical, "Error..."
Combo1.SetFocus
End If
If Combo2.Text = "" Or IsNull(Combo2.Text) Then
MsgBox "Please Select a Document Type", vbCritical, "Error..."
Combo2.SetFocus
End If
If Combo3.Text = "" Or IsNull(Combo3.Text) Then
MsgBox "Please Select a Document Type", vbCritical, "Error..."
Combo3.SetFocus
End If
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.