Access 2007 Shift +F2: VBA Double Click

Anonymous
2017-05-26T11:50:54+00:00

The database I am using has memo boxes with a substantial amount of data. I would like users to be able to double click on the memo box to zoom in and view all the data, instead of using the Shift + F2 keystroke. This is the module that was written in VBA to enable the double click feature. The Shift + F2 key works but the module does not. Is there another code that I should be using?

***Post moved by the moderator to the appropriate forum category.***

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
{count} votes

4 answers

Sort by: Most helpful
  1. Anonymous
    2017-05-26T12:19:08+00:00

    That ought to work.  Does any VBA code work in this database?  If the database isn't in a trusted location or individually trusted, code won't run.

    0 comments No comments
  2. Anonymous
    2017-05-26T13:32:00+00:00

    Thank you! That was the problem.

    0 comments No comments
  3. Anonymous
    2017-05-26T15:53:02+00:00

    Looks like I spoke too soon. I have added the file to a trusted location and it still will not allow me to run the VBA macro.

    0 comments No comments
  4. Anonymous
    2017-05-26T16:25:21+00:00

    Are you saying you moved the file to the ...\ACCWIZ folder?  If so, that's not a good place for it.  Instead, you should add a new trusted location, maybe your Documents folder, or whatever folder you currently have the database in.

    If you have the database in a trusted folder, have exited and re-entered Access, and reopened the database, and the zoom box is still not opening, then I have to ask again if any VBA code in the database runs.  If any VBA code runs, then the problem isn't a matter of trust.

    Hmm, I just noticed something in your original screenshot.  The window showing the code appears to be for a standard module, not a form module.  If that's the case, there's no reason that code would be run when a control on your form is clicked.  The code would have to be in the *form's* module!

    If that's the problem -- and now I strongly suspect it is -- then you need to open the form in design view, click the "View Code" button on the ribbon to edit its class module in the VB Editor (which will create a class module for the form if it doesn't exist), and paste the code into that module.  When you do that, the procedure should show (in the dropdown boxes at the top of the module window) as being associated with the DblClick event of the txtSTOCTMSLog control.  If it doesn't, you may have misspelled the name of the control.

    If you switch back to the design view window, click on the text box and open its property sheet, on the Event tab of the property sheet the "On Dbl Click" property should now show "[Event Procedure]".

    0 comments No comments