Share via

zoom box cursor control

Anonymous
2012-11-14T14:30:43+00:00

I am using the double click property on a field to allow the user to open the Zoom view

Private Sub comments_DblClick(Cancel As Integer)

' zoom

    SendKeys "+{F2}", True

End Sub

This works fine except it highlights the text as it opens and I know that a user will inadvertently end up just typing and overwriting the text that is already in the field. Is there any way i can get the cursor to move to the end of the text or just delselect the text?

Thanks

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2012-11-14T15:07:10+00:00

I did try a sendKeys F2 but the focu sI think is still in the form field and not in the zoom box so that does not work.

You'd need to send the F2 key immediately before opening the zoom box:

    SendKeys {F2}

    RunCommand acCmdZoomBox

However, I don't really recommend the use of SendKeys, in principle, because you can't really control what happens to the key once you've "sent it".  An alternative, albeit a more complex one, is to create your own "zoom" form and display that form in dialog mode instead of the built-in zoom box.  You can design the form so that it doesn't select the text automatically.

Was this answer helpful?

0 comments No comments

Answer accepted by question author

Tom van Stiphout 40,211 Reputation points MVP Volunteer Moderator
2012-11-14T14:41:29+00:00

You could try sendkeys of F2.

The zoom box can better be opened using RunCommand acCmdZoomBox.

Was this answer helpful?

0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Anonymous
    2012-11-14T16:10:06+00:00

    Please mark Tom's response as an answer also. I was just amplifying that response.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2012-11-14T15:00:27+00:00

    the runCommand is much neater thanks. I did try a sendKeys F2 but the focu sI think is still in the form field and not in the zoom box so that does not work. I am just concerned about Users deleting data as I know it will happen.

    Thanks

    Was this answer helpful?

    0 comments No comments