PREVIOUS NEXT SUBMIT command button on Tabsheet

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

Hi,

I need to get some good idea as to how I can create command buttons
(PREVIOUS, NEXT, and SUBMIT) efficiently on a tabsheet.

Here's what I currently have:
1. Unbound form with a 1 tabcontrol (2 sheets so far... there will be a
bunch more though)
2. In the Form Footer, I placed a PREVIOUS | NEXT | and SUBMIT button
3. Depending on the active page & some textbox criteria (e.g. "have all
textboxes been completed"), the 3 buttons are either enabled or disabled.
4. As of now, I can easily go back and forth between the 2 pages. The 3
buttons also do a validation check if all textboxes have been completed on
the active page (before I actually switch to the other page). For that, I
have OnEvent functions that call these validation checks.

Okay, here's now the dilemman I'm facing:
A. I need to add a bunch of additional worksheets
B. Because of that, the PREVIOUS and NEXT command buttons in the footer
appear not to be the right choice any longer. For instance (as of now),
NEXT calls "Page2" and PREVIOUS calls "Page1". Well, if I were on Page7
and want to go to Page 6 I would click PREVIOUS... that however would bring
up Page1 instead. The same would apply for the NEXT button. Hence, my
current approach won't work any longer.

So, my question is:
1. Is there a way to not hard-code some of the OnEvent functions based on
the Control Name?
2. If yes, how would I create these "dynamic command/navigation buttons"
that would still call the validation functions... depending on the current
"position" (page)?

I'd appreciate any pointers as to how I could best acccomplish this.

Thanks so much in advance,
Tom


I uploaded the SurveySample.zip to
http://tombock2004.i8.com/Test/
 
Not sure about your nav controls (Previous/Next in the form's footer usually
means go to previous/next record, since users are used to clicking on the
labeled Tab itself) however, you can use brief code on the OnClick event of
your Prev/Next buttons to set the "page index" number of your tab
controls/pages so that the first page =0 and the "next" page=1 for all
situations.
-Ed
 
Ed:

Thanks for the reply...

As you indicated, I am not referring to 'navigation buttons' to moved back
and forth between "records".

What I was referring to is to use command button which are named e.g. "Next,
Previous, etc."

I inserted now 5 pages into my tabcontrol sheet. Their page indices are:
0, 1, 2, 3, 4 (which were created by default).

Their "Names" (Other tab) are: Page1, Page2, Page3, Page4, Page5

Now, you suggested to use an OnClick event and create a few lines of code.
My question to you is the following:

What's the exact property that will allow me to navigate back and forth?

Also, how would I write it...

"Me.PageIndex = Me.PageIndex -1" for a Previous button
and
"Me.PageIndex = Me.PageIndex +1" for a Next button


Thanks,
Tom
 
Back
Top