Results 1 to 11 of 11

Thread: autoexpand column values not save in access 2016

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    VBAX Regular
    Joined
    Jan 2016
    Posts
    72
    Location
    Hello June7,

    Option Compare Database
    Option Explicit
    
    Private m_columnWidth As Long
    
    Private Sub Datum_KeyPress(KeyAscii As Integer)
    Select Case KeyAscii
        Case 43            ' Plus key
            KeyAscii = 0
            Screen.ActiveControl = Screen.ActiveControl + 1
        Case 45            ' Minus key
            KeyAscii = 0
            Screen.ActiveControl = Screen.ActiveControl - 1
        End Select
    End Sub
    
    Private Sub Form_Load()
        'save the original column width to a variable
        m_columnWidth = Me.Omschrijving.columnwidth
    End Sub
    
    Private Sub Form_Open(Cancel As Integer)
        DoCmd.SetWarnings False
        DoCmd.OpenQuery "qryUpdateVandaag", acViewNormal
        DoCmd.SetWarnings True
        Me.Requery
     End Sub
    
    Private Sub Omschrijving_Click()
        ' auto size Omschrijving column
        Omschrijving.columnwidth = -2
    End Sub
    
    Private Sub Omschrijving_GotFocus()
        'auto size Omschrijving column
        Omschrijving.columnwidth = -2
    End Sub
    
    Private Sub Omschrijving_LostFocus()
        ' re-instate the column width
        Omschrijving.columnwidth = m_columnWidth
    End Sub
    Here is also other code in my subform (datasheet) but these lines of code is not relevant for my question,
    Private Sub Datum_KeyPress(KeyAscii As Integer
    Private Sub Form_Open(Cancel As Integer
    Last edited by Aussiebear; 01-21-2025 at 01:11 AM.

Posting Permissions

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