Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2004

    Question Unanswered: ? re focus jump on first/last record only

    Sorry if this is elementary...

    I have a multi-page form setup in Single Form view with Command Buttons to move from page to page (like a tab control without the actual tab control).

    I also have my own Navigation Buttons to move from record to record (First, Previous, Next, Last, New). The code behind the nav buttons uses sytax like 'DoCmd.GoToRecord , , acFirst'.

    The command buttons for the tabs/pages and the nav buttons for the records all work well. The question here is why focus jumps to the first control on the first page when I move to either the first or last record? For example...

    If I am on Record 2 of 5, and I click the command button to view Page 2, then the focus is on the first control on Page 2. If I click cmdNext, I go to Record 3 of 5 and stay on Page 2. But if I click cmdPrevious instead, I go to Record 1 of 5 and jump to the first control on Page 1. I only jump off of Page 2 if my destination record is the first or last record of the set. If I go between records 2 and 4, no problem. Also, no problem if I use Access's standard nav buttons.

    So, why does DoCmd.GoToRecord make the focus jump pages/controls when I land on the first or last record?

    (Also, how to prevent it?)

    *If the answer isn't obvious to anyone, I will post sample DB.


  2. #2
    Join Date
    Dec 2004
    Madison, WI


    Not sure I fully understand but you can force the focus to any control using:


    If you're using tabs/pages, when you go to that specific page, Access will use the tab order for that page. Clicking on the page itself and then selecting View, Tab Order.. shows you the order of the controls. Your custom navigation bar might also have something to do with how it's handling the tab order.

    Hope that helps in some way.

    Paul Kohn
    Database Administrator

  3. #3
    Join Date
    Jul 2004

    more info...

    Actually, that doesn't solve the problem...

    Here's more info...

    If I am on Page 2 of a multi-page form, as I move between records, the form should (and does) stay on Page 2. The problem is that when I go to the first or last record of the set, the behavior changes and the focus jumps from Page 2 to Page 1.

    I can add code to move the focus back to Page 2, but the user will see the jumping. The question is why this behavior exists, and how to prevent it.

    I should note again that this queswtionable behavior only exists when I use my custom navigation buttons (cmdNext, cmdPrevious, etc) which utilize the DoCmd.GoToRecord code in VBA.

    Thanks again in advance,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts