vb command - press key

hi guys,

i have a database in msaccess, in one of the forms, i do not have much space, i have a tiny textarea, tht i would users to expand to read or enter data, so i know if you press Shift + F2, you can zoom the text area, how can i add this 2 keys as a code in vb, something like
if textarea get the focus, then zoom in(Shift + F2)
please expalin

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Eric ShermanAccountant/DeveloperCommented:
I would recommend doing this ....  Using the DoubleClick Event of your Text Control.

Private Sub YourTextFieldNameHere_DblClick(Cancel As Integer)
    DoCmd.RunCommand acCmdZoomBox
End Sub

This will open your fied in a Zoom Box.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Boyd (HiTechCoach) Trimmell, Microsoft Access MVPDesigner and DeveloperCommented:
You could do the same thing as ET suggest using the On Enter or On Focus event. You might want to do both On Enter and Double click.
Jeffrey CoachmanMIS LiasonCommented:
<No points wanted>

One thing to note is that if this is set up to happen automatically, it may become annoying for users just tabbing past this field.

Can I ask why it is not an option to simply redesign the form to allow this control to be made bigger?
(post a screenshot)
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
I highly recommend not using double click, because the Windows Standard UI for double click in a text box is to highlight (select) text.  Users *expect* this to happen.

"if textarea get the focus,"

Private Sub txtBox_GotFocus()
    If Nz(Me.txtBox, "") > "" Then DoCmd.RunCommand acCmdZoomBox
    'or just DoCmd.RunCommand acCmdZoomBox
End Sub

But, I don't even recommend doing this either, for exactly the reason boag2000 said ... users will get VERY annoyed when tabbing through controls.

So, I would stick with Shift F2  or, but a small button next to the text box, and use the Magnifying glass image ... with this code:

Private Sub btnZoom1_Click()
    DoCmd.RunCommand acCmdZoomBox
End Sub

I personally use Shift+Double Click to zoom, wherein I detect the Shift Key using windows API calls.


It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.