MsgBox

y481184

Board Regular
Joined
Aug 1, 2003
Messages
137
To ensure valid data, I have created a message box that will appear if an incorrect value is inserted into one of my forms. However, after the msgbox appears, and I click OK, the focus does not return to the point of error. Instead, the second form procedes to be displayed. Any Ideas?
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

y481184

Board Regular
Joined
Aug 1, 2003
Messages
137
Case Else
MsgBox "You Have Entered an Invalid Vendor Code", vbCritical, "Invalid Vendor"
txtVenCode.SetFocus
End Select
 

WillR

Well-known Member
Joined
Feb 18, 2002
Messages
1,143
sorry, but that snippet of your code does not really tell me why this is not working as you expect. Can you post the relevant section of code ... cheers
 

TryingToLearn

Well-known Member
Joined
Sep 10, 2003
Messages
723
Case Else
MsgBox "You Have Entered an Invalid Vendor Code", vbCritical, "Invalid Vendor"
txtVenCode.SetFocus
End Select

As Will said, it's easier if you have more code posted, but for a guess I would:


Case Else
MsgBox "You Have Entered an Invalid Vendor Code", vbCritical, "Invalid Vendor"
txtVenCode.SetFocus
exit sub
End Select
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,102
Messages
5,768,102
Members
425,454
Latest member
khoro

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top