Can't set a form size... feel dumb :(

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • deewe
    New Member
    • Jun 2009
    • 15

    Can't set a form size... feel dumb :(

    Hello,

    I'm unable to resize the visible part of a form only to display what I want to show. (upper left)

    Here what I did:
    - I made a form with a tab control that has 3 pages
    - Added all fields I needed below the "tab page"
    - Copy/pasted each fields in each appropriate "tab page"

    => The tabbing control works and display the pages, but I can still scroll down the "hidden" fields. Access does not let me resize the form size as there are the "hidden" fields below.

    Been trying most of the controls and searched the web for some time now but I saw no answers of how to fix this simple issue.

    Thanks for your help.
  • hjozinovic
    New Member
    • Oct 2007
    • 167

    #2
    hi deewe,
    I tried to get the same results and find a solution for you. In short... try moving all the fields you don't want to be visible to the form's footer area.
    Then make that footer area invisible by setting it's Visible property to false.
    Try it out and tell us if this works. If not, we will find something else :-)

    Comment

    • DonRayner
      Recognized Expert Contributor
      • Sep 2008
      • 489

      #3
      Hi Deewe;

      Welcome to Bytes.

      Since the controls are not visible you can just move them up the form to be under the tab control and then not have to worry about them.

      You could set the scroll bar property of the form to "neither" that way you wont have the scroll bars to scroll with. With the scroll bars off you don't have to worry about resizing the form. Just resize the forms window to display what you want.

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32633

        #4
        Controls being invisible to the operator doesn't mean they're invisible to Access.

        It is not (nor has ever been) possible to position controls outside of the form itself. Another way of saying this is that the form will automatically set its dimensions to include all controls (hidden or otherwise).

        This isn't something you can change. It's not really something you'd want to as far as I can see, as it would make absolutely no sense.

        Having said this, it seems you already have some suggested solutions to your actual problem. Some quite good ones actually.

        Welcome to Bytes!

        Comment

        • OldBirdman
          Contributor
          • Mar 2007
          • 675

          #5
          Here what I did:
          - I made a form with a tab control that has 3 pages
          - Added all fields I needed below the "tab page"
          - Copy/pasted each fields in each appropriate "tab page"
          The controls that you want hidden are duplicates of the controls on the tab page. Why do you need these controls duplicated? Although sometimes a duplicate control (two controls bound to the same field) is desirable, in this case it seems to hinder your form design.

          The simple solution is to delete the unneeded controls.

          Comment

          • deewe
            New Member
            • Jun 2009
            • 15

            #6
            Thanks a lot to hjozinovic, DonRayner and NeoPa.

            I used the form footer trick as I was still able to scroll down the form with the mouse wheel even having disabled the scroll bars.

            I'm getting stuck on other things now ;) but I'm going to mess with them and see if I can do it by myself.

            Originally posted by OldBirdman
            The controls that you want hidden are duplicates of the controls on the tab page. Why do you need these controls duplicated? Although sometimes a duplicate control (two controls bound to the same field) is desirable, in this case it seems to hinder your form design.

            The simple solution is to delete the unneeded controls.
            I wish it was possible but is seems you can't directly add fields into tabbed control field.

            So as explained elsewhere I added all my fields in the form then copy/pasted them in each appropriate tab page.

            Comment

            • OldBirdman
              Contributor
              • Mar 2007
              • 675

              #7
              I would agree that sometimes Access seems to want to put new controls on the form, under the tab control. If, after selecting the control in the 'Toolbox', you click an incorrect tab (you have 3 tabs) and then the correct tab, you then click where you want the control, and it will work.

              But I don't see where this matters. You have the controls on the tab page now, and they work.
              => The tabbing control works and display the pages
              How they got there doesn't matter any more. Now delete the duplicates, and size your form.

              Comment

              • deewe
                New Member
                • Jun 2009
                • 15

                #8
                Originally posted by OldBirdman
                I would agree that sometimes Access seems to want to put new controls on the form, under the tab control. If, after selecting the control in the 'Toolbox', you click an incorrect tab (you have 3 tabs) and then the correct tab, you then click where you want the control, and it will work.
                Honestly you lost me... thanks for trying though!

                Comment

                • OldBirdman
                  Contributor
                  • Mar 2007
                  • 675

                  #9
                  1) Do you have the controls on the tab page now?
                  2) Do the controls (on the tab page) work?

                  If the answers to 1 and 2 are 'Yes', then:
                  a) Remove the controls you want to keep from showing. Delete them.
                  b) Size the form to include the tab page and any controls remaining.

                  Comment

                  • deewe
                    New Member
                    • Jun 2009
                    • 15

                    #10
                    Originally posted by OldBirdman
                    1) Do you have the controls on the tab page now?
                    2) Do the controls (on the tab page) work?

                    If the answers to 1 and 2 are 'Yes', then:
                    a) Remove the controls you want to keep from showing. Delete them.
                    b) Size the form to include the tab page and any controls remaining.
                    Surprisingly it worked, thanks.

                    Although I don't understand why I wasn't able to move directly the controls on the tab pages without having to copy paste them first.


                    On a side note I'm learning the hard way: try & errors... I just discovered even if your tables are well linked you still need to make queries to get the data in the forms. ;)

                    Q?:
                    - I have a table with items and one with the different types. One item can be of only one type. Isn't it better to add an auto number primary key in the types tables and link the tables with it than the type names, this even if the names are unique?

                    - Would you use the same form to browse data entries and update/add items or is it better to have 2 separate forms?

                    Comment

                    • NeoPa
                      Recognized Expert Moderator MVP
                      • Oct 2006
                      • 32633

                      #11
                      Originally posted by deewe
                      Q?:
                      - I have a table with items and one with the different types. One item can be of only one type. Isn't it better to add an auto number primary key in the types tables and link the tables with it than the type names, this even if the names are unique?

                      - Would you use the same form to browse data entries and update/add items or is it better to have 2 separate forms?
                      1. This is sometimes preferable. It's hard to say if this is right for you as the information provided is scarce and unclear.
                        Some processes require reordering of the data. This is generally done by creating a temporary index on the fly. This will always use the PK to point to the individual records. With this in mind restricting the size of this index (An AutoNumber is 8 bytes) will restrict the amount of space required for the temp index and therefore its access times.
                      2. This is often a matter of preference.
                        I found a good suggestion the other day though :
                        Change the background colour of the form (or some other visible flag) when it changes between edit and add modes.

                      Comment

                      • deewe
                        New Member
                        • Jun 2009
                        • 15

                        #12
                        Originally posted by NeoPa
                        1. This is sometimes preferable. It's hard to say if this is right for you as the information provided is scarce and unclear.
                          Some processes require reordering of the data. This is generally done by creating a temporary index on the fly. This will always use the PK to point to the individual records. With this in mind restricting the size of this index (An AutoNumber is 8 bytes) will restrict the amount of space required for the temp index and therefore its access times.
                        2. This is often a matter of preference.
                          I found a good suggestion the other day though :
                          Change the background colour of the form (or some other visible flag) when it changes between edit and add modes.
                        Thanks a lot for your inputs!

                        Now I have to find how to detect edit mode and change the background color;)

                        Comment

                        • NeoPa
                          Recognized Expert Moderator MVP
                          • Oct 2006
                          • 32633

                          #13
                          I was working on this recently so here is a snippet of code I did then :
                          Code:
                          Option Compare Database
                          Option Explicit
                          
                          Private Const conNewRec As Long = 8388608
                          Private Const conExistingRec As Long = 8421440
                          
                          Private Sub Form_Current()
                              Call SetLocked
                          End Sub
                          
                          Private Sub Form_AfterUpdate()
                              Call SetLocked
                          End Sub
                          
                          Private Sub SetLocked()
                              Call ChangeColour(blnNewRec:=Me.NewRecord)
                          End Sub
                          
                          Private Sub ChangeColour(blnNewRec As Boolean)
                              Dim lngColour As Long
                          
                              With Me
                                  lngColour = IIf(blnNewRec, conNewRec, conExistingRec)
                                  .FormHeader.BackColor = lngColour
                                  .Detail.BackColor = lngColour
                                  .FormFooter.BackColor = lngColour
                              End With
                          End Sub
                          
                          Private Sub cmdExit_Click()
                              Call DoCmd.Close
                          End Sub

                          Comment

                          • deewe
                            New Member
                            • Jun 2009
                            • 15

                            #14
                            Thanks NeoPa,

                            I'm not as far in my access knowledge yet but I'll surely try to understand your code later when I'm ready!

                            Comment

                            • NeoPa
                              Recognized Expert Moderator MVP
                              • Oct 2006
                              • 32633

                              #15
                              It's fairly straightforward if you don't let the number of lines frighten you.

                              Lines :
                              1-2: Standard option settings.
                              4-5: Defining the colour constants. Use other colours as you choose.
                              7-9 &
                              11-13: When a record is selected or saved we know we want the SetLocked() procedure to run.
                              15-17: The procedure simply calls the ChangeColour() procedure.
                              19-28: Determines the colour required, then sets the colours for the three standard sections on a form. No problem if the section isn't even used or shown.
                              30-32: Close when the cmdExit button is clicked. You may not need this.

                              Comment

                              Working...