Hello everyone,
I have a subform which includes a Tab Control with 8 pages. I want to hide the pages tabs to force users navigating from a page to another and giving required data/info. So I created 2 Command Buttons (Next Page) and (Previous Page).
The Next Page code is:
Private Sub NextPage_Click()
TabMainPages.Value = (TabMainPages.Value + 1) Mod TabMainPages.Pages.Count
End Sub
Which works perfectly moving from a page to another and starts over from the first page.
While I put the code below for Previous Page command button:
Private Sub PreviousPage_Click()
TabMainPages.Value = (TabMainPages.Value - 1) Mod TabMainPages.Pages.Count
End Sub
It works moving back to previous pages, but once reaches the first page (value 0), then I get a Debug error that there is an invalid item in the code. So, how can I slightly change the code of Previous Page command button to fix this error.
Thank you so much for your help and support.
I have a subform which includes a Tab Control with 8 pages. I want to hide the pages tabs to force users navigating from a page to another and giving required data/info. So I created 2 Command Buttons (Next Page) and (Previous Page).
The Next Page code is:
Private Sub NextPage_Click()
TabMainPages.Value = (TabMainPages.Value + 1) Mod TabMainPages.Pages.Count
End Sub
Which works perfectly moving from a page to another and starts over from the first page.
While I put the code below for Previous Page command button:
Private Sub PreviousPage_Click()
TabMainPages.Value = (TabMainPages.Value - 1) Mod TabMainPages.Pages.Count
End Sub
It works moving back to previous pages, but once reaches the first page (value 0), then I get a Debug error that there is an invalid item in the code. So, how can I slightly change the code of Previous Page command button to fix this error.
Thank you so much for your help and support.