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

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Case Else
MsgBox "You Have Entered an Invalid Vendor Code", vbCritical, "Invalid Vendor"
txtVenCode.SetFocus
End Select
 
Upvote 0
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
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,599
Messages
6,120,448
Members
448,966
Latest member
DannyC96

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
Back
Top