locked
four page form working with tab RRS feed

  • Question

  • Building four page form and unable to figure how to utilize a tab control with pop up forms. I have pop up forms ready but when run tab at the end of page go back for new record and I want to continue to next page until I reach end of fourth page.

    Greatly appreciate help. 

    Best Regards, 

    John Corems

    slovenc@aol.com


    John

    Wednesday, April 4, 2018 7:50 PM

Answers

  • Hi John,

    Not sure I follow your setup. Can you post some screenshots maybe to help us understand your needs? Thanks.

    • Marked as answer by John Corems Saturday, April 14, 2018 1:18 PM
    Wednesday, April 4, 2018 7:52 PM
  • Thank you for get back to me. 

    Not sure how to make screen, therefore I will try to explain beter way if possible for you to understand.

    With Acess 2013 I'm building four page form. (all four page required to be fill in) Since I'm unable to make four page in one set, I have created in Pop up form four different forms and prepared them to be fill in. Problem is as I fill first page, at the end of page my TAB go back to the top and open ID # 2. I like that at end of page my TAB to go to second page of four and allow me to fill in, then go to third page and then to fourth. Someone respond to may early message (last week and told me to set all four pages as Pop up then with utilizing TAB I be able to do what I want to do. Well I was able to got al four pages in Pop up, but unable to figure how to put all four forms together into one TAB order, so I can have four pages as one record. Now I have each page as individual record. Hope that is more clear. I'm from Europe and self learning person who want to know more as I can. So far all it going OK and if I be able to figure all four page into one system it will work great for me. 

    Best regards.


    John

    • Marked as answer by John Corems Saturday, April 14, 2018 1:18 PM
    Wednesday, April 4, 2018 9:54 PM
  • Building form with 4 pages and by sugestion from one gentelmen from forum, (was a great idea) I need to add two buttons, (one for next and another for prev) so I be able with tab to run between four forms and fill them out. Try to found how to do and have no luck. Anyone know WHERE IS THE BEEF?  Can someone give me direction how to create button to go from first form to form # 2 or 3 or 4, so as to go backward.

    Thank you and best Regards


    John

    Thursday, April 5, 2018 8:45 PM
  • John,

    In your new Button in the OnClick Event add the line suggested.

    note you need to replace the TabCtl with the name of your own tab control...


    Brian, ProcessIT- Hawke`s Bay, New Zealand

    • Marked as answer by John Corems Saturday, April 14, 2018 1:20 PM
    Friday, April 6, 2018 2:55 AM
  • You really don't need 4 forms - in its simplest incarnation you have 1 form with a tab control with 4 tabs, but assuming you really have 4 forms, I would use code like this (untested air code follows)

    Assume you have 4 forms named myForm1 through 4. Each has two buttons named cmdPrevForm and cmdNextForm.

    Also assume we do not want to write repetitive code, so we will write ONE procedure in a Standard Module, and call it from the eight buttons. For example the myForm1's Next button has:
    HandlePrevNext Me.cmdNextForm

    (and so do the Next buttons on all 4 forms)

    The one procedure I'm thinking of is like this:

    Public Sub HandlePrevNext(ByRef cmd As CommandButton)
        Const MinForm As Integer = 1
        Const MaxForm As Integer = 4
        Dim strFormName     As String
        Dim strPrevNext     As String
        Dim intForm         As Integer
        'Find out which form has called this procedure.
        strFormName = cmd.Parent.Name
        intForm = Right(strFormName, 1)
        'Did we click Prev or Next?
        strPrevNext = Mid$(cmd.Name, 4, 4)

        'Calculate which form to show next. Handle edge cases.
        intForm = intForm + IIf(strPrevNext = "Next", 1, -1)
        If intForm < MinForm Then intForm = MaxForm
        If intForm > MaxForm Then intForm = MinForm

        DoCmd.OpenForm Left$(strFormName, Len(strFormName) - 1) & intForm
        DoCmd.Close acForm, strFormName
    End Sub

    Does this make sense?

       


    -Tom. Microsoft Access MVP

    • Marked as answer by John Corems Saturday, April 14, 2018 1:20 PM
    Friday, April 6, 2018 4:06 AM

All replies

  • Hi John,

    Not sure I follow your setup. Can you post some screenshots maybe to help us understand your needs? Thanks.

    • Marked as answer by John Corems Saturday, April 14, 2018 1:18 PM
    Wednesday, April 4, 2018 7:52 PM
  • Thank you for get back to me. 

    Not sure how to make screen, therefore I will try to explain beter way if possible for you to understand.

    With Acess 2013 I'm building four page form. (all four page required to be fill in) Since I'm unable to make four page in one set, I have created in Pop up form four different forms and prepared them to be fill in. Problem is as I fill first page, at the end of page my TAB go back to the top and open ID # 2. I like that at end of page my TAB to go to second page of four and allow me to fill in, then go to third page and then to fourth. Someone respond to may early message (last week and told me to set all four pages as Pop up then with utilizing TAB I be able to do what I want to do. Well I was able to got al four pages in Pop up, but unable to figure how to put all four forms together into one TAB order, so I can have four pages as one record. Now I have each page as individual record. Hope that is more clear. I'm from Europe and self learning person who want to know more as I can. So far all it going OK and if I be able to figure all four page into one system it will work great for me. 

    Best regards.


    John

    • Marked as answer by John Corems Saturday, April 14, 2018 1:18 PM
    Wednesday, April 4, 2018 9:54 PM
  • Hi John Corems,

    From your above description, I understand that you are having four forms.

    When user finish the first form you want to open the second form and so on.

    I suggest you to add 2 buttons on the bottom of your each form to move to next and previous form.

    You can try to display the next form if user click on button next and you can display previous form if user click on previous button.

    Form names for next and previous buttons are hard codded for each buttons.

    I understand that all 4 forms are one single form but because you don't have enough space you design like this.

    So you can submit all the data on last form.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, April 5, 2018 6:36 AM
  • Building form with 4 pages and by sugestion from one gentelmen from forum, (was a great idea) I need to add two buttons, (one for next and another for prev) so I be able with tab to run between four forms and fill them out. Try to found how to do and have no luck. Anyone know WHERE IS THE BEEF?  Can someone give me direction how to create button to go from first form to form # 2 or 3 or 4, so as to go backward.

    Thank you and best Regards


    John

    Thursday, April 5, 2018 8:45 PM
  • Hi John,

    If you want to move to the Next Record on the Same Form, then your button code would use:

    docmd.GoToRecord acDataForm,me.name,acNext

    Or change acNext to acPrevious  to move to the Previous 

    If you need to navigate to a Page on your multi page form use:

    Me.GoToPage 2
    where 2 is the page number to go to...


    Brian, ProcessIT- Hawke`s Bay, New Zealand

    Thursday, April 5, 2018 9:35 PM
  • Hi John,

    To move to the next Tab you can use:

    me.TabCtl = 1

    This will move to the Second Tab as Tabs are 0 based; with 0 being the First Tab...


    Brian, ProcessIT- Hawke`s Bay, New Zealand

    Thursday, April 5, 2018 9:43 PM
  • Good day Sir,

    Thank you for your sugestion to create buttons for next and previous. Great idea Since I'm dumb in more profesinal work with access, I was looking how to create button with next or previous and unable to figure. Someone send me sugestion as follow: me.TabCt1 = 1. All good but he did not instruct me where to do this and how. I'm amateur in this. Hope someone can help me more detailed how to do this.

    Best Regards,


    John

    Thursday, April 5, 2018 10:04 PM
  • Thank you for your sugestion on Tab. Just since I'm "Bimbo" in details like this, I have no clue where to start and where to finsh this process. Hope you can get mo more detailed advice

    Best regards


    John

    Thursday, April 5, 2018 10:06 PM
  • John,

    In your new Button in the OnClick Event add the line suggested.

    note you need to replace the TabCtl with the name of your own tab control...


    Brian, ProcessIT- Hawke`s Bay, New Zealand

    • Marked as answer by John Corems Saturday, April 14, 2018 1:20 PM
    Friday, April 6, 2018 2:55 AM
  • You really don't need 4 forms - in its simplest incarnation you have 1 form with a tab control with 4 tabs, but assuming you really have 4 forms, I would use code like this (untested air code follows)

    Assume you have 4 forms named myForm1 through 4. Each has two buttons named cmdPrevForm and cmdNextForm.

    Also assume we do not want to write repetitive code, so we will write ONE procedure in a Standard Module, and call it from the eight buttons. For example the myForm1's Next button has:
    HandlePrevNext Me.cmdNextForm

    (and so do the Next buttons on all 4 forms)

    The one procedure I'm thinking of is like this:

    Public Sub HandlePrevNext(ByRef cmd As CommandButton)
        Const MinForm As Integer = 1
        Const MaxForm As Integer = 4
        Dim strFormName     As String
        Dim strPrevNext     As String
        Dim intForm         As Integer
        'Find out which form has called this procedure.
        strFormName = cmd.Parent.Name
        intForm = Right(strFormName, 1)
        'Did we click Prev or Next?
        strPrevNext = Mid$(cmd.Name, 4, 4)

        'Calculate which form to show next. Handle edge cases.
        intForm = intForm + IIf(strPrevNext = "Next", 1, -1)
        If intForm < MinForm Then intForm = MaxForm
        If intForm > MaxForm Then intForm = MinForm

        DoCmd.OpenForm Left$(strFormName, Len(strFormName) - 1) & intForm
        DoCmd.Close acForm, strFormName
    End Sub

    Does this make sense?

       


    -Tom. Microsoft Access MVP

    • Marked as answer by John Corems Saturday, April 14, 2018 1:20 PM
    Friday, April 6, 2018 4:06 AM
  • Good Morning ( 2 AM in USA,) 

    As I read few sugestions how to created buttons prev and next in project I working on one form long four pages, my problem is I have no clue where in form I should wrote all that sugestions. I'm dumb with this. Learned how to create form but, unable to figured how to tune up. Hope you understand my problem. Not sure where to start with next and where to start with prev. 

    Aniway I thank you for your effort 


    John

    Friday, April 6, 2018 7:25 AM
  • Good Morning (2 AM in USA)

    Oh boy. By reading your sugestion it may end my night of sleep. Have no clue where to wrote all that. not that big and profesional expert. I was hope that be more simple way. On beginning you mentioned that I do not need 4 forms Like to explain. It's one form but due to lenght of entire form Access did not let me make this form in one continuous page, therefore I was forced (the best I can think) to create four diferent forms and mark them as page 1; page 2; page 3 and page four. It serve purposes but when you want to fill form and as you going with TAB from one fileable point to next and in bottom of form it take you to NEW. Instead to NEW I like to create button to take me to page two. then to page 3 and to last fourth page. With all this instruction you send me it be understanable how and most imprtant WHERE to place all this info you send me. It may be way to complicated for my amateur knowledge of database. 

    Best Regards, 


    John

    Friday, April 6, 2018 7:36 AM
  • Hi John Corems,

    You had mentioned that," Not sure where to start with next and where to start with prev. "

    I assume that Your form contains Tab Control having several tabs.

    Now you can make Next and Previous button on your main form.

    To move to next tab , You can try to increase tab control's value with 1.

    To move to previous tab , You can try to decrease tab control's value with 1.

    Tab control's value starts with 0.

    Then on the button click event, You can add code like below.

    Private Sub Command29_Click()
    Me.TabStrip0.Value = Me.TabStrip0.Value - 1
    End Sub
    
    Private Sub Command30_Click()
    Me.TabStrip0.Value = Me.TabStrip0.Value + 1
    End Sub

    Reference:

    TabControl.Value Property (Access)

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, April 9, 2018 1:27 AM
  • Good Day sir,

    Thank you for your help. Since I never work with this before from your explanation I was able to understand basic where to go. I was able to move from page to page but when I click on tab it got me message "Method or data member not found. After I close that message I see on screen page number two, which told me that I'm close to learn one more item in this process. Just few questions which may be I do not understand

    On line 1 where say Private sub and at the end there are (). Is there I need to enter any info in that area? 

    Also when I create another Tab control it did not allow me to enter any text like NEXT or PREV. there was allways two pages on each tab control. What to enter in firs page (if any) and what to enter on second page (if any) 

    Hope that will clear my brains and finaly got to understand how it this work. 

    You did great to help me this far and hope you can help me to the bottom of this, so I can finish my project whay I want to be,

    Best Regards,


    John

    Thursday, April 12, 2018 9:48 AM
  • Hi John Corems,

    First you need to add tab control on form.

    Then you can right click on it to add new tabs.

    Then you can attach your forms to it.

    Then you need to create 2 buttons on main form (not on tab control).

    Then if you select the button in design view and go to its property sheet.

    You will find Events Tab. You need to select on click event and select [Event procedure] from the drop down menu.

    it will open VBA code editor and you can see the click event of the button.

    You need to put this code there.

    Private Sub Command5_Click()
    Me.TabCtl0.Value = Me.TabCtl0.Value - 1
    End Sub
    
    Private Sub Command6_Click()
    Me.TabCtl0.Value = Me.TabCtl0.Value + 1
    End Sub

    Then you need to open the form in Form view.

    You will get output below.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Friday, April 13, 2018 9:41 AM
  • Good Mornng, 

    Before I ask question I like to say Thank you for last instruction I received. I know now how to use Tab Control. 

    By nature of may, I hate to ask more with out I offer some compensation to you for your time and effort. I very much appreciate way you help me and I like if you send me on my E mail your mailing address and I promise to send you some compensation for nice dinner with glass of vine or beer of your choice. As business man (now retired) I understand that any help you got, it need to be some how reimbursed. So please do not hesitate to send me address where to send check by my bank. 

    Now only one question from instruction you send me. As for now I'm working on tab control to understand better before I go to buttons. I transfer my forms and it work great from all aspects but one. It confuses me that I have two records with two scrol bars, which is not great convenience. When I run Tab from top of form and as I got to the bottom form did not move by self. I need to use mouse to move form up or dawn Outside form has only one record and my forms has a 8 records. Do not understand what is outside form since I was unable to do anythyng to move to record # 2. In main time my forms work great other but dealing with two screol bars. 


    John

    Saturday, April 14, 2018 1:34 PM
  • Dear sir, 

    My last question I ask you it may be ignored. I have figured out by anchoring uper left corner. Not know what this mean, but my layout is way I like to be. Of course my offer for compensation firmply stand and looking forward to Thank you for your help. Now I will start working on buttons next and prev and see where this go. Will let you know.

    Best regards.


    John

    Saturday, April 14, 2018 6:09 PM
  • Good Day, One issue was resolved and working on buttons. I noticed on picture you have a "Command Button" I was unable to found at any location this button. Can you show me where to found him. Thank You. 

    John

    Sunday, April 15, 2018 12:18 AM
  • Hi John Corems,

    You had asked," I was unable to found at any location this button. Can you show me where to found him."

    First, You can open the Form in design view.

    Then you can find the controls in Design tab. As you can see in picture below.

    You can add that button control on a form and use it further to execute VBA code on button's click event.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, April 16, 2018 1:26 AM