The New {f2}

jaydwest

JayW
Local time
Today, 05:29
Joined
Apr 22, 2003
Messages
340
I have a proc that copies all the text from a field on a form. Works great when the Database Option "Behavior entering field" is set to ( ) Select entire field. One of my clients prefers ( ) Go to start of field. When the last option is selected my code BLOWS! The Applicable code is

Me![Control].SetFocus
Docmd.RunCommand acCmdCOpy

To resolve this one, I have changed the code to

Me![Control].SetFocus
If me![Control].SelLength = 0 Then
SendKeys "{F2}"
End IF
Docmd.RunCommand acCmdCopy

This works great and I'm almost happy. However somewhere in some past version of MS Access I recall reading the SendKeys should not be used (If possible). I have searched to find the code that will do what SendKeys "{F2}" will do but must need another cup of java this morning because I cannot find it.

So my question is is (sound like BIll Clinton) there anything I can use that is blessed by the powers to be to replace it?

Thanks for your help
 
Bob,

Thanks for the fast reply. However the issue isn't with the "{F2}" key, it is with the SendKeys. I think it was in Access 2000 that the folks in Redmond introduced the Docmd.RunCommand that was supposed to replace the SendKeys command. At the time I read in some book that they would keep SendKeys to maintain compatibility, but recommended people use the Docmd. RunCommand instead. The bad news is that they did not include all the functionality of the SendKeys, e.g. SendKeys "{F2}".

Maybe I should have asked is there anything to replace SendKeys "{F2}" that is blessed by the Redmond crew?

Thanks again.
 
What I was getting at was that it seemed that you wanted to find out what, exactly, the F2 was doing so that you could find the appropriate RunCommand for it. And since each version of Access could be different, I was giving you the reference to figure out exactly that.
 

Users who are viewing this thread

Back
Top Bottom