How do I set the focus to detail section of contiuous form?

Posted on 2012-08-24
Last Modified: 2012-08-24
I have a listbox in the detail section of a continuous form.  I click in the listbox and scroll with mousewheel through the list.  When I click out of the listbox and on to the detail section, The mousewheel continues to scroll the listbox.  I want it to scroll the form.  In order to do this, I have to click into another control (not another listbox), on the detail section.  I have tried using the detail section onclick event and the forms onclick event to no avail.    Any suggestions?

Question by:leachj
    LVL 119

    Expert Comment

    by:Rey Obrero

    LVL 6

    Accepted Solution

    The SetFocus method is not available on a section of the form.  If it is utilized on the Form itself, it uses the current default control on the form.

    The best suggestion that I can give is that you create a button (my example is named "cmdBLANK") that has a width and height of 0.  Then on your detail section use the OnClick event and set the focus to the command button:

    Private Sub Detail_Click()
    End Sub

    Open in new window

    The fact that you have set the command button to do nothing allows for nothing to happen that will effect your application.

    Author Comment

    True, there is no setfocus for the sections.  I've tried to setfocus on controls in the detail section using its onclick event to no avail.  However in going back, and trying again it seems to work.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    This isn't a frequent question on EE. I must have seen it three or four times (among several thousand questions). However, I use this trick quite often, most frequently as a delayed Current event. A form does not expose it's calculation dependenc…
    Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
    With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now