Retaining focus when field validation fails

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.
 
P

Patricia Cardoza [Outlook MVP]

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
 
S

Sue Mosher [MVP-Outlook]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top