Form Appearance

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hawg1
    New Member
    • Sep 2006
    • 7

    #1

    Form Appearance

    I would like to have the area on my form, where a subform is located, to be an empty box with a border when the main form is initially opened. Then when user clicks on a button, the actual fields comprising the subform are visible, ready for the user to enter the required data.

    The main form is an initial entry point in which the user can select four options (Insert new data, delete existing data, query exisiting data, and save data), which is why I would like the inital appearance of the form to be the four buttons and an empty box where the subform will eventually be displayed.

    Any suggestions?!

    Thanks

    Hawg1
  • PEB
    Recognized Expert Top Contributor
    • Aug 2006
    • 1418

    #2
    Ok,
    In your on Open Event procedure you type:

    If your subform is based on columns / datasheet:

    Code:
    Me![SUBFORM].Form![F1].ColumnHidden = True
    Me![SUBFORM].Form![f2].ColumnHidden = True
    If your subform is like form view:

    Code:
    Me![SUBFORM].Form![F1].Visible = False
    Me![SUBFORM].Form![f2].Visible = False
    In the case of form view it's better to put a rectangle box on top that you change its visible option to visible or invisible!

    :)

    Comment

    • hawg1
      New Member
      • Sep 2006
      • 7

      #3
      PEB,

      Thanks for the code suggestion. I understand that the name of the subform goes into the [SubForm] part of the code.

      I'm unsure what should go into the [F1] or [F2] part. Could you please elaborate for me? I'm new to VBA and am slowly learning all of the terminology.

      Thanks for your help

      Hawg1

      Comment

      • PEB
        Recognized Expert Top Contributor
        • Aug 2006
        • 1418

        #4
        No, no, no

        This code you have to place it in your Main Form, On Open Event you assign Event procedure and you store the code there!

        SUBFORM is the name of the control that is stored your subform

        AND f1 f2 and so on are the names of the fields in your subform that you want to control from your main form

        Now is it more clear?

        Hope yeah!

        Best regards!

        :)

        Comment

        • hawg1
          New Member
          • Sep 2006
          • 7

          #5
          PEB,

          I'm probably losing it as I can't seem to get it to work. I keep getting error messages that state 'can't fine field...'

          So I figured I would start over some what. I created a new blank form called hide test in design view. I then draged the form PersAction_Pers Data (contains several text/combo boxes) onto the detail section of the form hide test. Save and open the form and the subform is present.

          I then enter the following into the OnOpen event of the form hide test (to save time, I only used the first text box on the subform):

          Code:
          Private Sub Form_Open(Cancel As Integer)
          Me!PersAction_PersData.Form!SSN.Visible = False
          
          End Sub
          When I open the form I get the following error:

          RunTime Error '2465':
          MS Office Access can't find the field 'PersAction_Per sData' referred to in your expression.


          What am I missing or doing wrong?


          Originally posted by PEB
          No, no, no

          This code you have to place it in your Main Form, On Open Event you assign Event procedure and you store the code there!

          SUBFORM is the name of the control that is stored your subform

          AND f1 f2 and so on are the names of the fields in your subform that you want to control from your main form

          Now is it more clear?

          Hope yeah!

          Best regards!

          :)

          Comment

          • PEB
            Recognized Expert Top Contributor
            • Aug 2006
            • 1418

            #6
            Hi,
            The only reason to have this error is that the control

            PersAction_Pers Data doesn't exist in your form!

            Pls check the name of your control that is stored your form and verify that it's name is:

            PersAction_Pers Data

            This is not name of form but name of control!

            :)

            Comment

            • hawg1
              New Member
              • Sep 2006
              • 7

              #7
              PEB,

              Thanks for the help. I got her working. I finally decided to just delete the subform and install a new one on the main form and everything is working.

              Originally posted by PEB
              Hi,
              The only reason to have this error is that the control

              PersAction_Pers Data doesn't exist in your form!

              Pls check the name of your control that is stored your form and verify that it's name is:

              PersAction_Pers Data

              This is not name of form but name of control!

              :)

              Comment

              • PEB
                Recognized Expert Top Contributor
                • Aug 2006
                • 1418

                #8
                Good solution !

                Best regards!

                :)

                Comment

                Working...