Full Version: "next" And "back" Button Question
UtterAccess Forums > Microsoft® Access > Access Forms
SpiritedAway
Hi All,
wonder if anyone could help me with this problem - I'm sure its simple enough - but I've got a block.
I have three subforms on my mainform - each of these subforms has its visibility set to False.
The idea is I have a Next button on the mainform, when the user clicks the button it cycles through the subforms:
So
"next" > subform1 is visible (2,3 not) > "next" subform2 is visible (1,3 not) > "next" subform3 is visible (1,2 not) > when it reaches the end the "next" button greys out and a "back" button appears so that when that's clicked it cycles back through subform3 > subform2 > subform1 > until that is diabled and "next" is enabled again.
Can anyone advise on the kind of code to achieve this?
Thanks so much for your help
John Spencer
Basically the code for the Next button would look like the following pseudocode.
!--c1-->
CODE
If SubForm1.Visible Then
   SubForm2.Visible = True
   SubForm2.SetFocus
   Subform1.visible = False
ElseIf SubForm2.Visible Then
   SubForm3.Visible = True
   SubForm3.SetFocus
   Subform2.visible = False
ElseIF SubForm3.Visible Then
   SubForm3.Visible = True
   SubForm3.SetFocus
   Subform2.visible = False
   Me.NextButton.Visible = False
   Me.BackButton.Visible = true
ElseIF subForm1.visible = False THEn
   Me.subForm1.Visible = True
   Me.subForm1.SetFocus
End if

The back button would use similar code just reversing the order
SpiritedAway
Thanks so much for your prompt reply john - i will give the code you suggest a try now.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.