Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / May 2008

Tip: Looking for answers? Try searching our database.

expand and retract form procedure

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
AccessARS - 23 May 2008 18:26 GMT
I have a form which is being used to enter criteria of a report.  While this
form is open I would like to have an "Advanced>>" command that would
drop/expand the bottom of the form with additional search options.

My attempt: I inserted a sub form with the additional search options on the
footer of the main form minimized in design view with the following
properties, can grow, can shrink and not visible.  In the main form I set the
properties to can and can shrink.  My expectations were to have the procedure
behind the command set the sub-form visible property to TRUE.  Although the
Sub-Form appears the Footer does not expand therefore it overlaps.  I also
placed it on the bottom of Detail but it just didn’t allow the sub-form to
grow or overlap.

Thank you in advance for your time.
Steve Sanford - 24 May 2008 08:57 GMT
Maybe this will help...

1) In a form, in the form header add a button (mine is named Command11).

2) In the form footer, add 3 text boxes.

  My text boxes were named "Text17" (and the label "Label18"), "Text 19"
("Label20") and "Text21" ("Label22").

3) In design view, for all the text boxes and labels, set the top at 0.05".

   For each of the text boxes and labels set:

      "Label18" - Left = 0.25"
      "Text17" -  Left = 1"

      "Label20" - Left = 2.2"
      "Text19" -  Left = 2.7"

     "Label22" - Left = 4"
     "Text21"  - Left = 4.7"

4) Set the form footer height = 0.25"
5) Set the caption for the button to "Advanced>>"

6) Add the code for the button:

'-----code beg-------
Private Sub Command11_Click()
 Dim strCaption As String
 Const vbGray = 12632256

 strCaption = Me.Command11.Caption
 
 Select Case strCaption
   Case "Advanced>>"
     'expand the footer
     Me.FormFooter.BackColor = vbWhite
     ' set footer height = 2"
     ' 1 inch = 1440 twips
     Me.FormFooter.Height = 2 * 1440

     'show text boxes in the footer
     Me.Text17.Visible = True
     Me.Text17.Left = 1 * 1440
     Me.Text17.top = 0.05 * 1440
     'attached label for Text17
     Me.Label18.Left = 0.25 * 1440
     Me.Label18.top = 0.05 * 1440
     Me.Label18.Visible = True

     Me.Text19.Visible = True
     Me.Text19.Left = 1 * 1440
     Me.Text19.top = 0.35 * 1440
     'attached label for Text19
     Me.Label20.Left = 0.25 * 1440
     Me.Label20.top = 0.35 * 1440
     Me.Label20.Visible = True

     Me.Text21.Visible = True
     Me.Text21.Left = 1 * 1440
     Me.Text21.top = 0.7 * 1440
     'attached label for Text21
     Me.Label22.Left = 0.25 * 1440
     Me.Label22.top = 0.7 * 1440
     Me.Label22.Visible = True
     Me.Command11.Caption = "<<Hide"

   Case Else
     'hide text boxes in the footer
     Me.Text17.Visible = False
     Me.Text17.Left = 1 * 1440
     Me.Text17.top = 0.05 * 1440
     'attached label for Text17
     Me.Label18.Left = 0.25 * 1440
     Me.Label18.top = 0.05 * 1440
     Me.Label18.Visible = False

     Me.Text19.Visible = False
     Me.Text19.Left = 2.7 * 1440
     Me.Text19.top = 0.05 * 1440
     'attached label for Text19
     Me.Label20.Left = 2.2 * 1440
     Me.Label20.top = 0.05 * 1440
     Me.Label20.Visible = False

     Me.Text21.Visible = False
     Me.Text21.Left = 4.7 * 1440
     Me.Text21.top = 0.05 * 1440
     'attached label for Text21
     Me.Label22.Left = 4 * 1440
     Me.Label22.top = 0.05 * 1440
     Me.Label22.Visible = False

    'Hide the footer
     Me.FormFooter.BackColor = vbGray
     Me.FormFooter.Height = 0.25 * 1440

     Me.Command11.Caption = "Advanced>>"
 End Select

End Sub
'-----code end-------

HTH
Signature

Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)

> I have a form which is being used to enter criteria of a report.  While this
> form is open I would like to have an "Advanced>>" command that would
[quoted text clipped - 10 lines]
>
> Thank you in advance for your time.
AccessARS - 28 May 2008 01:26 GMT
Thank you...this is definitly a working option but I was able to make my
subform work with the docmd.movesize action on the main form.

> Maybe this will help...
>
[quoted text clipped - 116 lines]
> >
> > Thank you in advance for your time.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.