[AccessD] Set control to 'edit' in VBA?

Penn White pennwhite at hotmail.com
Fri Apr 22 16:53:37 CDT 2005


Does anyone know of a way to send a user back to a control and have it 
already be in Edit Mode (F2) when they get there?

I can send the user back using Me!MyControl.SetFocus but then the field is 
entirely highlighted and if they type anything before hitting F2 then the 
entire highlighted data will be replaced by the new character(s).

I'm using it in a custom validation routine for phone numbers.  If they type 
in an incorrect number of numbers or start with a '1' or enter illegal alpha 
or extended characters, it pops up a message telling them to try again. 
Before checking the number for length, all the extraneous characters (like 
( or ) or - or " ") are stripped and then if it is a valid 10 character 
integer, it is reformatted to a standard format.  This is done in the OnExit 
event because sometimes the phone numbers are cut and pasted from somewhere 
else and this does not trigger the AfterUpdate event.  There may be a better 
way to do this but this is the one I've come up with so far.

I believe I saw somewhere that there is a way to do this globally for the 
entire database but I'd rather just have it apply as I need it.  Generally, 
I find it's good to have everything highlighted when you enter a control.

Thank you,

Penn 



More information about the AccessD mailing list