G
Guest
Please help. I know just enough to get myself into trouble.
I would like to increment a date field with "+" or "-" keys, and use it as
a default on the next data entry form. The following code almost works. The
"+" & "-" keys work to increment the date, but when I go to the next form, it
doesn't carry over as the default. If I physically type in the date, it will
work as a default. (I also have the same problem with a numeric field, if
there is a difference.)
Thanks!!
Private Sub Date_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
Case 61 ' Equal key
KeyAscii = 0
Screen.ActiveControl = Screen.ActiveControl + 1
Case 95 ' Underscore key
KeyAscii = 0
Screen.ActiveControl = Screen.ActiveControl - 1
End Select
End Sub
Private Sub Date_AfterUpdate()
With Me.Date
If Not IsNull(.Value) Then
.DefaultValue = """" & .Value & """"
End If
End With
End Sub
I would like to increment a date field with "+" or "-" keys, and use it as
a default on the next data entry form. The following code almost works. The
"+" & "-" keys work to increment the date, but when I go to the next form, it
doesn't carry over as the default. If I physically type in the date, it will
work as a default. (I also have the same problem with a numeric field, if
there is a difference.)
Thanks!!
Private Sub Date_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
Case 61 ' Equal key
KeyAscii = 0
Screen.ActiveControl = Screen.ActiveControl + 1
Case 95 ' Underscore key
KeyAscii = 0
Screen.ActiveControl = Screen.ActiveControl - 1
End Select
End Sub
Private Sub Date_AfterUpdate()
With Me.Date
If Not IsNull(.Value) Then
.DefaultValue = """" & .Value & """"
End If
End With
End Sub