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