Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 67
  • Last Modified:

Zoom box macro

Experts, I need a macro for the zoom box.  I cant seem to get it right.  How to convert the below to a macro?  

Private Sub Purpose_DblClick(Cancel As Integer)

    DoCmd.RunCommand acCmdZoomBox
   
End Sub
0
pdvsa
Asked:
pdvsa
  • 4
  • 2
  • 2
  • +1
1 Solution
 
Helen FeddemaCommented:
That works for me -- it should work for you, assuming that Purpose is the name of a textbox (it is best to give controls the appropriate prefixes, to avoid confusion with their bound fields).  Here is the code I made, and the Zoom box pops up when I double-click in the textbox:

Private Sub txtPurpose_DblClick(Cancel As Integer)

   DoCmd.RunCommand acCmdZoomBox

End Sub

Open in new window


Occasionally, event procedures get detached from their controls, so check that you can open the procedure from the control's property sheet.
0
 
pdvsaAuthor Commented:
Hi Helen, yes, it does work for me as well however I want to be able to choose this in a macro instead of writing the code each time.
0
 
Helen FeddemaCommented:
In that case, make a public function in a standard module:

Public Function ZoomBox()

   DoCmd.RunCommand acCmdZoomBox
   
End Function

Open in new window

and a macro that calls it with the RunCode macro action, which you can then attach to the DblClick event of many controls.

Zoom macro
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
pdvsaAuthor Commented:
Perfect.  thank you.
0
 
Anders Ebro (Microsoft MVP)Microsoft DeveloperCommented:
Note that you could instruct your users to use Shift-F2, which is the keyboard shortcut to trigger the Zoombox.
0
 
Helen FeddemaCommented:
That is true, though Shift-F2 doesn't work currently on my computer (I think it is a hardware issue with the keyboard).  There are usually two or three different ways to do anything in Access.
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
Interesting .... I've never seen Shift+F2 not work.
0
 
Helen FeddemaCommented:
F2 alone doesn't work either (for opening the Object Browser).
0
 
Anders Ebro (Microsoft MVP)Microsoft DeveloperCommented:
Helen, it sounds like you have disabled Access Special Keys in your database. You will find this setting under "Options"->Current Database.
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
Ahh ... that could be it Anders. In fact, that somehow happened to me a while back.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 4
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now