Retaining focus when field validation fails

  • Thread starter Thread starter Michael fuerst
  • Start date Start date
M

Michael fuerst

On a Outlook form, when a control associated with a custom property
changes,
Sub Item_CustomPropertyChange is invoked. If the code in this Sub
determines that the entered value is invalid, how can focus be made to
remain on the offending control? I tried w/i Sub
Item_CustomPropertyChange the statement
Item.GetInspector.ModifiedFormPages("Message").Controls("control_name").SetFocus
but that did not work.

The SetFocus statement works correctly within the Item_Send function,
but I'm trying to catch bad input when the user completes the field.
 
It should work. Can you post the entire code for the CustomPropertyChange
sub?

--
Patricia Cardoza
Outlook MVP
Author - Special Edition Using Microsoft Office Outlook 2003
Lead Author - Access 2003 VBA Programmer's Reference
Author - Absolute Beginner's Guide to Microsoft OneNote 2003

http://blogs.officezealot.com/cardoza
 
SetFocus is flakey. I'm not sure you can get it to work in this case. My
hypothesis is that the CustomPropertyChange event fires and its code runs,
then Outlook completes moving the focus to the control that the user
selected.
 
Back
Top