Automatic move to next Access tab page
-
Im using Access 2002. My database is in Access 2000 format. Im designing a form to collect responses to a 40-item questionnaire. I can fit four list boxes on a screen, so I plan to have 11 tab pages (one page at the end for collecting identifying information) on my form. To ease the task for the user, Id like to have an automatic movement to the next page. For instance, when the user clicks on the choice for Question 4 (the last of the items on Page1), the focus automatically shifts to Question 5 (the first of the items on Page2). I know about entering code as an event procedure. I assume that I need to enter code on the Event tab for the List Box that contains the Question 4 answer. 1. For which Event do I enter the code (After Update, On Enter, On Click)? 2. What code should I enter? 3. Can I use this same method for all of the moves from one page to the next? (I know how to set a command to close the form. My plan is to have a command button on the last page that says, You may review your answers by clicking on the tabs. When you are done, click on the button to close the form.) Thanks.
-
Answer:
bruces- Thanks for the question. First, I feel that I should caution you that automatically switching pages when a user selects a value may cause aggrivation for the user- it will happen so fast that the user will not always be certain that he or she clicked the appropriate value. You may want to run the changes by your users to get their feedback. That being said, there are a couple of ways that you can approach this- but you probably want to use the Click event to handle your code in both approaches. The first option is to have a separate Click event handler for the last list box on each page that will explicityly set the focus to the first list box on the next page. The other option, which I favor and for which the following code applies, is to have a generic Click event handler that automatically sets the focus to the next page. This approach, however, requires that you set the TabOrder for each page so that the appropriate ListBox always has the focus when the Page of the Tab control switches. The following sample code can be used to accomplish your goal: [---------begin code listing-------------] ' a generic subroutine that will handle the click events in the ' proper fashion. we call this routine from every List Box that needs to ' change the page Private Sub HandleClick() Dim thisPage As Control Set thisPage = Me.ActiveControl.Parent If thisPage.PageIndex = (tabMyTab.Pages.Count - 1) Then MsgBox ("You have completed the form") Exit Sub End If tabMyTab.Pages(thisPage.PageIndex + 1).SetFocus End Sub [---------end code listing-------------] With that one routine you can handle the click event in any ListBox you like. Simply add the following line of code to any ListBox Click Event handler that needs to be able to switch the page: Call HandleClick So if you had a ListBox named List16 its Click event handler would look like this: [---------begin code listing-------------] Private Sub List16_Click() Call HandleClick End Sub [---------end code listing-------------] Hopefully this solves your problem for you. Please let me know if there is anything that I might help clarify. Search strategy --------------- None, I used my experience with Access and Visual Basic to find a solution.
bruces-ga at Google Answers Visit the source
Related Q & A:
- How to move to next picture in the same folder?Best solution by answers.microsoft.com
- How will the search rank get impacted if i move my mobile website to a single page application?Best solution by Webmasters
- How do you save a page as a tab?Best solution by Answerbag.com
- How do I find favorites tab on new yahoo page?Best solution by Yahoo! Answers
- When exactly is the next google page rank update?Best solution by wiki.answers.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.