[AccessD] After having picked a date

Gustav Brock gustav at cactus.dk
Sun May 1 02:01:03 CDT 2016


Hi All

I've found a solution to a problem that have bothered me ever since the datepicker was introduced: How to move on after having picked a date?

I found out that all you may have to do is to move the mouse:

<code>
Private Sub Detailsection_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

    ' Adjust control names to fit your form.
    Const DateTextboxName   As String = "txtOrderDate"
    Const NextFocusControl  As String = "txtShipDate"
    
    ' Ignore errors from validation or the like that
    ' will block setting focus to NextFocusControl.
    On Error Resume Next
    
    If Screen.ActiveControl.Name = DateTextboxName Then
        With Me(DateTextboxName)
            If IsDate(.Text) Then
                If IsNull(.Value) Or DateDiff("d", DateValue(.Text), .Value) <> 0 Then
                    Me(NextFocusControl).SetFocus
                End If
            End If
        End With
    End If
    
End Sub</code>

 /gustav


More information about the AccessD mailing list