Force before update event... (1 Viewer)

MackMan

Registered User.
Local time
Today, 12:57
Joined
Nov 25, 2014
Messages
174
I have a date field, that can be changed via "+/-" keys on the numeric key pad by increments of either plus or minus one day.

Because data within the field physically wont change by typing a new value, is there any way of forcing the before update event to fire if it's changed?

Am I right in thinking the only way to do so, would be to use VBA to copy the new value, and paste within itself (if that makes any sense) thus firing a dirty event for that date field.

I've been racking my brain for a couple of days on this one, and still cant get it to work.

As always, any advice appreciated.

Thank you

Code I'm using for the +/- keys (if it helps) is...
Code:
Private Sub TransDate_KeyDown(KeyCode As Integer, Shift As Integer)
If Not IsNull(Me.TransDate) Then
   If KeyCode = 107 Then
     Me.TransDate = Me.TransDate + 1
        KeyCode = 0
    ElseIf KeyCode = 109 Then
     Me.TransDate = Me.TransDate - 1
        KeyCode = 0
End If
    
ElseIf IsNull(Me.TransDate) Then
   If KeyCode = 107 or KeyCode = 109 Then
     Me.TransDate = Date
        KeyCode = 0
    End If
End If
End Sub
 

missinglinq

AWF VIP
Local time
Today, 07:57
Joined
Jun 20, 2003
Messages
6,423
Not sure of what you're trying to do, here, but if the TransDate_KeyDown event fires then you've changed the value in TransDate, so I'd simply Call the BeforeUpdate event as the last line in TransDate_KeyDown. The syntax would be

Call TransDate_BeforeUpdate(0)

Linq ;0)>
 

Users who are viewing this thread

Top Bottom