Rabu, 27 Juli 2011

[MS_AccessPros] Re: Continuous subform change height based upon the amount of lines? Several of the

 

Before I go further, I'd like to know if I can have several continuous forms that adjust in size on one form. If the first form is zero height the second would have to move up.

thanks!
Connie

--- In MS_Access_Professionals@yahoogroups.com, "horastacatto" <zctek@...> wrote:
>
> Hi Connie,
>
> Have a look at the two routines below and modify as
> neccesary.
>
> '~~~~~~~~~~~~~~~~
> Private Sub Form_Load()
> Dim lngFrmHeight As Long
> On Error Resume Next
> If Me.CurrentView = 1 Then
> DoCmd.MoveSize 0, 450, , 5000
> Else
> DoCmd.RunCommand acCmdSizeToFitForm
> End If
>
> lngFrmHeight = GetFormHeight()
> Me.InsideHeight = lngFrmHeight
> If Me.Recordset.RecordCount = 0 Then
> If vbNo = MsgBox("No Messages to display. Do you want to see old messages?", _
> vbYesNo + vbDefaultButton2, "fMessages") Then
> DoCmd.Close
> Else
> cmdViewAll_Click
> End If
> End If
>
> End Sub
> '~~~~~~~~~~~~~~~~
> Public Function GetFormHeight() As Long
> ' Calculate the height, in Twips, needed for the form based on recordcount.
> ' Height of FormHeader and FormDetails is taken into account.
> Dim lngHeight As Long
> Dim intRecs As Integer
> On Error GoTo MyErr
>
> intRecs = Me.RecordsetClone.RecordCount + Me.AllowAdditions * -1 ' Maybe add 1
> lngHeight = intRecs * Me.Section("Detail").Height
> lngHeight = lngHeight + Me.Section("FormHeader").Height
> lngHeight = lngHeight + Me.Section("FormFooter").Height
> If Me.DividingLines Then lngHeight = lngHeight + 20 ' To show last divider
> 'If Me.NavigationButtons Or (Me.ScrollBars Mod 2) Then lngHeight = lngHeight + 150
> GetFormHeight = lngHeight ' Result is in Twips
>
> MyExit:
> Exit Function
> MyErr:
> MsgBox "Err = " & Err & vbCrLf & Err.Description
> Resume MyExit
> End Function
> '~~~~~~~~~~~~~~~~
>
> Hope that helps.
>
> Regards, Clive.
>
> --- In MS_Access_Professionals@yahoogroups.com, mrsgoudge <no_reply@> wrote:
> >
> > I have a continuous subform in a form. I've read that the CanGrow property does not really apply to it. I would like for the subform to grow based upon whether there's data in it. The input is an address and the subform should have one line for each time that property was listed.
> >
> > I intend to have several of these continuous subforms in one form. Will that work? Ex: 1st subform has one line, 2nd subform has 3 lines, 3rd subform has 0 lines. And of course this would vary based upon the underlying queries results.
> >
> > I have opted to not use a report since I'd like a button for each line which would open up the underlying form.
> >
>

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar