Full Version: Datasheet Form Column Resize
UtterAccess Forums > MicrosoftŪ Access > Access Forms
On my sub form, which I display in datasheet view on the main form, I added the event Double-Click so the users can perform the function by double-clicking the row they want to open.
Is there still a way to allow the users to double-click the column headers and resize the column automatically?
Have a look at Stephen Lebans work which does that.
... Hmmm ...
would rather have the users dbl-click a field (like a row identifier) to "open" a row ... then the dbl-click column header boarder will autosize the column as you would expect.
If you want to keep your current method of doing things, You could take a look at the .SelHeight and .SelWidth properties of the form to determine the appropriate action to take ...
Private Sub Form_DblClick(Cancel As Integer)
    Select Case True
        Case Me.SelHeight = 1 And Me.SelWidth <> 1
            MsgBox "A single row or single row range is selected"
            ' Do your "open record" stuff
        Case Me.SelWidth = 1 And Me.SelHeight > 1
            MsgBox "A column or single column range is selected"
            ' Do anything else
        Case Else
    End Select
    'Show the range you have selected
    MsgBox Me.SelHeight & " rows and " & Me.SelWidth & " columns selected"
End Sub
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.