Sabtu, 07 Mei 2016

Re: [MS_AccessPros] Decreasing row height

 

Steve-


You need to detect the control type.  Try this:

Option Compare Database
Option Explicit
Const intIncrement As Integer = 250

Private Sub cmdDecreaseDetailHeight_Click()
    Dim ctl As Control
    For Each ctl In Me.Section(0).Controls
        If ctl.ControlType = acLine Then
            ctl.Top = ctl.Top - intIncrement
        Else
            ctl.Height = ctl.Height - intIncrement
        End If
    Next
    Me.Section(0).Height = Me.Section(0).Height - intIncrement
   
End Sub

Private Sub cmdIncreaseDetailHeight_Click()
    Dim ctl As Control
    
    Me.Section(0).Height = Me.Section(0).Height + intIncrement
    For Each ctl In Me.Section(0).Controls
        If ctl.ControlType = acLine Then
            ctl.Top = ctl.Top + intIncrement
        Else
            ctl.Height = ctl.Height + intIncrement
        End If
    Next
End Sub


John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)



On May 7, 2016, at 9:42 PM, Steve5 thaw5@suddenlink.net [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:



That did it John. Thank you. Forgive me for blindsiding you and Bill about the layout control. I don't know enough yet to know what's important and what's not. 

Please allow me to ask one more question: Removing the layout control also removed the horizontal line that was between records. I put a line across the bottom of the detail section. The line looks OK when the form opens. But its height changes with the increase/decrease height commands by moving its right side up or down. The line's left side does not move. How do I get a horizontal line to follow the records as they increase and decrease in height?

Thank you. Steve

On 5/7/2016 2:51 PM, John Viescas JohnV@msn.com [MS_Access_Professionals] wrote:

Uh, probably!  The default is to put the controls in a Layout.  You need to get rid of that!


Open the form in Design view.  Select any control in the detail section.  Click on the Arrange tab, and then click Remove in the Control Layout section.

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)



On May 7, 2016, at 8:11 PM, Steve5 thaw5@suddenlink.net [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:



I should be able to develop a sample database with a few records.

Here is something else which may have a bearing on my problem: I created a query with four fields to be the data source for the form. Then I highlighted the query in the navigation pane. Then went to the ribbon's Create tab and in the Forms section clicked on Multiple Items. Access created the form under discussion. Does this method of creating the form cause any problems with Bill's button event code?

Steve

On 5/7/2016 11:31 AM, John Viescas JohnV@msn.com [MS_Access_Professionals] wrote:

You said you can't upload the database.  Is it possible to create a "sample" database with dummy info and the forms that demonstrate the problem?  If so, you could upload that.  If not, then perhaps a screen shot of the form with the white space and another with the form in Design view might help.


John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)



On May 6, 2016, at 7:21 PM, Steve thaw5 thaw5@suddenlink.net [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:



Duane, thanks for that idea. But same results . . . blank white space between the rows with the decrease button. 

On 5/6/2016 10:46 AM, Duane Hookom duanehookom@hotmail.com [MS_Access_Professionals] wrote:

This code in a form worked as expected for me:

Option Compare Database
Option Explicit
Const intIncrement As Integer = 250

Private Sub cmdDecreaseDetailHeight_Click()
    Dim ctl As Control
    For Each ctl In Me.Section(0).Controls
        ctl.Height = ctl.Height - intIncrement
    Next
    Me.Section(0).Height = Me.Section(0).Height - intIncrement
   
End Sub

Private Sub cmdIncreaseDetailHeight_Click()
    Dim ctl As Control
    
    Me.Section(0).Height = Me.Section(0).Height + intIncrement
    For Each ctl In Me.Section(0).Controls
        ctl.Height = ctl.Height + intIncrement
    Next
End Sub



To: MS_Access_Professionals@yahoogroups.com
From: MS_Access_Professionals@yahoogroups.com
Date: Fri, 6 May 2016 16:21:03 +0200
Subject: Re: [MS_AccessPros] Decreasing row height



Steve-

Can't see why that isn't working.  What happens if you do a Requery?

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)



On May 6, 2016, at 4:09 PM, Steve5 thaw5@suddenlink.net [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:



Click events for the two command buttons:

Private Sub cmdIncreaseDetailHeight_Click()
    Me.Section(0).Height = Me.Section(0).Height + 250
    logID.Height = logID.Height + 250
    logDateEntered.Height = logDateEntered.Height + 250
    logEntry.Height = logEntry.Height + 250
    logAttach.Height = logAttach.Height + 250
End Sub

Private Sub cmdDecreaseDetailHeight_Click()
    logID.Height = logID.Height - 250
    logDateEntered.Height = logDateEntered.Height - 250
    logEntry.Height = logEntry.Height - 250
    logAttach.Height = logAttach.Height - 250
    Me.Section(0).Height = Me.Section(0).Height - 250
End Sub

Thank you. Steve

On 5/5/2016 10:38 AM, Duane Hookom duanehookom@hotmail.com [MS_Access_Professionals] wrote:

Steve,
Please post your code.
 
Duane Hookom, MVP
MS Access
 

To: MS_Access_Professionals@yahoogroups.com
From: MS_Access_Professionals@yahoogroups.com
Date: Thu, 5 May 2016 10:27:36 -0400
Subject: Re: [MS_AccessPros] Decreasing row height



Thanks Glenn and John for the advice. I am able to increase detail section height, but the height of the rows remains constant and space is inserted between rows. Decreasing detail section height decreases the space between rows. Seems to me that changing detail section height alone is not enough. Thoughts?

Thanks, Steve

On 5/4/2016 4:55 PM, John Viescas JohnV@msn.com [MS_Access_Professionals] wrote:
 
Steve-

You need to be changing the Height of the Detail section of the subform, not the Row Height.

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
http://www.viescas.com/ 
(Paris, France)

On May 4, 2016, at 10:49 PM, Steve thaw5 thaw5@suddenlink.net [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

I'm using a continuous form to display rows of data. A command button 
programmatically increases row height by 500 twips for each click. 
Another button decreases row height by the same amount.

When the form opens, the rows are butted up against each other. When I 
click the button to increase row height, the height increases and the 
rows are butted up against each other. Here's the problem: when I click 
to button to decrease row height, the height decreases but the rows no 
longer abut each other. There is a blank white space between each row. 
How do I decrease row height and get the rows to abut each other, i.e., 
no space between the rows?

Thanks.

Steve

------------------------------------
Posted by: Steve thaw5 <thaw5@suddenlink.net>
------------------------------------

------------------------------------

Yahoo Groups Links























__._,_.___

Posted by: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (23)

.

__,_._,___

Tidak ada komentar:

Posting Komentar