Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2015

    Unanswered: Data sheet resizing, breaking layout.

    I have a data sheet (in Access 2003) where one of the columns will resize when I add a new line. I have tried a lot of different things to fix this (I didn't design the database) but I can't seem to find what is happening. I have included a video because I feel like it is something that I can't describe that well.
    The column "Their Description" resizes when you click to add a new line, breaking the layout and making a scroll bar show up. when this is run at lower resolutions it is even worse.
    Even if you can suggest where I start looking for the problem that would help.
    Here is the Video

    Thanks so much

  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    so don't use datasheets is the smart aleck answer

    ...not helpful I know, but what I suspect is happening is that the datsheet adjusts its layout to fit the space each column theoretically requires. so it may well overflow, especailly if the text/string column is set too wide.

    persoanlly I don't use datasheet view. if a spreadsheet presentation is required then ill dump the data into a spreadsheet. If I have to ui use a datasheet view to display data but never ever allow users to enter data. althoygh the view is getting better over time it doenst' allow the same flexibility and code optiosn to ensure data is handled correctly, is vallid and so on.
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Feb 2015
    Thanks for taking the time to answer. Did you watch the video? I ask because I have no data in the "Their Description" and it only expands when I add a new line, and it is empty.
    Can I force it to never expand/resize?

  4. #4
    Join Date
    Mar 2009
    Provided Answers: 15
    Quote Originally Posted by Ramsey View Post
    ... Can I force it to never expand/resize?
    Not sure but you can force it to go back to its previous layout. In the Form Class Module:
    Private m_varLayout As Variant
    Private Sub Form_AfterUpdate()
        Dim i As Long
        For i = 0 To UBound(m_varLayout, 2)
            With Me.Controls(m_varLayout(0, i))
                .ColumnHidden = m_varLayout(1, i)
                .ColumnWidth = m_varLayout(2, i)
                .ColumnOrder = m_varLayout(3, i)
            End With
        Next i
    End Sub
    Private Sub Form_Open(Cancel As Integer)
        Dim ctl As Control
        Dim col As Collection
        Dim i As Long
        Set col = New Collection
        For Each ctl In Me.Controls
            If ctl.ControlType = acTextBox Then col.Add ctl
        Next ctl
        ReDim m_varLayout(0 To 3, 0 To col.Count - 1)
        For i = 0 To col.Count - 1
            m_varLayout(0, i) = col.Item(i + 1).Name
            m_varLayout(1, i) = col.Item(i + 1).ColumnHidden
            m_varLayout(2, i) = col.Item(i + 1).ColumnWidth
            m_varLayout(3, i) = col.Item(i + 1).ColumnOrder
        Next i
        Set col = Nothing
    End Sub
    Have a nice day!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts