Access - Open form in new tab

Solved
klrblz Posted messages 265 Status Member -  
JustinAmani Posted messages 2 Status Member -
Hello,
I would like to know if it is possible to configure a form to open on a specific tab (opening via a control button).
Second small question, is it possible to configure my database in such a way as to open a particular form when the document is opened.
Thanks in advance

Klr

(I am using Office 2007)
Configuration: Windows XP Internet Explorer 6.0

7 answers

  1. blux Posted messages 5032 Registration date   Status Moderator Last intervention   3 455
     
    Well then, you just need to ask the right question :-)))

    In your button, after opening the form, add:

    forms![établissements]!nom_de_l_onglet.value = 1 (for the second page of the tab, for example).

    The square-bracketed 'établissements' is there to avoid interfering with ACCESS because of the accents. More generally, this is something to do when using 'exotic' characters in object names (spaces and other fun stuff...).

    Would that work?

    --

    A+ Blux           
     "Les cons, ça ose tout. C'est même à ça qu'on les reconnaît"
    1
  2. blux Posted messages 5032 Registration date   Status Moderator Last intervention   3 455
     
    Hi,

    1- Do you want to open a form and position yourself on a particular tab? In that case, you put a little code in the open event of your form, something like:

    me.nom_de_l_onglet.value = n (where n ranges from 0 to the number of pages of the tab minus 1, 0 being the leftmost page...)

    2- http://www.commentcamarche.net/forum/affich 2780341 access lancement formulaire au demarrage

    --

    A+ Blux

    "Les cons, ça ose tout. C'est même à ça qu'on les reconnaît"
    0
  3. klrblz Posted messages 265 Status Member 210
     
    Thank you very much

    The 2 works like a charm

    For the 1, I'm sorry but I'm terrible at vb, could you tell me where to put the snippet you indicated, here’s the one that opens the right form:

    Private Sub bt-resto_click()
    DoCmd.openform"établissements", acnormal

    End sub

    The tab I would like is named "restauration", it has number 2

    It would be really cool...
    0
  4. blux Posted messages 5032 Registration date   Status Moderator Last intervention   3 455
     
    In your 'establishments' creation form, you click on Properties, go to the 'Event' tab, click on the line 'on open', then in the dropdown that appears at the end of the line select '[Procedural Event]', then you type this code:

    me.restauration.value = 2

    But it is likely that you are confusing the label of the 'page of the tab' with the name of your 'tab object', in which case the name 'restauration' might not be correct and the number may be incorrect (perhaps 1, for the second page of the tab).

    --

    A+ Blux           
     "Les cons, ça ose tout. C'est même à ça qu'on les reconnait"
    0
  5. klrblz Posted messages 265 Status Member 210
     
    Okay okay, in fact I misspoke, so this solution (though very simple) doesn’t satisfy me.
    I have a "home" form (report question 2 from earlier), on it I have buttons (the ones I want to program to open my "establishments" form)
    The snag is that several buttons on the home lead to the "establishments" form, but on different tabs. I cannot therefore use your method which, correct me if I’m wrong, only programs the opening of the "establishments" form on a particular tab.

    I’m therefore looking to put code on the buttons on the home: the code I sent you, I can’t add a line or a criterion saying on which tab to open?

    Thank you again for your help
    0
  6. klrblz Posted messages 265 Status Member 210
     
    Execution error 438 Property or method not supported by this object

    Private Sub bt_resto_Click()
    DoCmd.OpenForm "établissements", acNormal
    Forms! [établissements]!Restauration.value = 2
    End Sub

    It highlights the line Forms!... in yellow
    0
    1. blux Posted messages 5032 Registration date   Status Moderator Last intervention   3 455
       
      Surely, as I mentioned above, you confuse the name you gave to a page of your tab object with the tab itself. You need to find the object’s name. Click on the tab in creation mode to select it, then double-click next to the list of pages that compose it (where there are no more tab pages, but still on the object itself). A window titled 'Tab Control: tab_name' will appear. It is this name that must be put into the code. This should work. -- A+ Blux "Les cons, ça ose tout. C'est même à ça qu'on les reconnaît"
      0
    2. JustinAmani Posted messages 2 Status Member
       
      Hello Nickel, I’m also interested in your answer but I’d like to insert a back button on a form X that does not contain tabs to another form that contains tabs, and now I’m going to open the "Agent" tab No. 2 of this Form Z. What should I do Please?
      0
  7. klrblz Posted messages 265 Status Member 210
     
    YES!! It works great
    A big thank you for your patience, your explanations, and for the other post as well (attachments in Access). It really helps me move forward.
    Have a good rest of the day.
    0
    1. JustinAmani Posted messages 2 Status Member
       
      Hello Nickel, I’m also interested in your answer but I’d like to insert a back button on a form X that does not contain tabs, toward another form that does contain tabs, and now I’m going to open the “Agent” Tab N°2 of this Form Z. What should I do, please? ??
      0