Zoom Box command button

G

Guest

I'd like to create a command button that acts as a Shift+F2 function (zoom
box). The button needs to be linked to a specifix text box control.

Any ways to do this in VBA?

Thanks.
 
P

Pat Hartman

In the dbl-click event of the control you want to zoom:

DoCmd.RunCommand acCmdZoomBox

When someone double clicks in the control, the zoom box will open.
 
D

Dirk Goldgar

In
Gaetan said:
I'd like to create a command button that acts as a Shift+F2 function
(zoom box). The button needs to be linked to a specifix text box
control.

Any ways to do this in VBA?

Although I would normally do this the way Pat Hartman suggests, and use
the text box's DblClick event, if you really want it to be triggered by
a button, you can do it like this:

Private Sub cmdZoom_Click()

Me!txtYourTextbox.SetFocus
RunCommand acCmdZoomBox

End Sub

Alternatively, you could have the button zoom whatever control
previously had the focus, like this:

On Error ResumeNext
Screen.PreviousControl.SetFocus
RunCommand acCmdZoomBox
 
G

Guest

That works great! Exactly what I needed.... Thanks Dirk.

Thanks to Pat for his alternative.
 
E

Eelco de Vries

Hi there!
Tried suggested solution, worked perfect.
Well, allmost. The problem is now that the button used to zoom keeps looking
like it has focus. I have the buttons on the details section of a continous
form, and when I haven't clicked yet, the buttons each become yellow-edged
when I mouse-over them. When I click, the text-field next to it gets focus
and opens the zoombox.
When I close this zoombox, *all* the buttons next to all the textfields now
have this "mouse-over" look (orange-yellow edged).
How do I bring this buttons back to default state?
Tried with repaint, didn't work. Is there a "loose-focus" like there is a
"setfocus"?
 

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

Similar Threads

Configuring the ACCESS Zoom Box 4
ability to open zoom box features 2
Zoom box end of text 1
Memo Zoom Box Trigger 3
Memo Zoom Box 1
Zoom Box Font 2
zoom in on range 1
Zoom Box Font - Change Permanently 4

Top