Check Box and Date

Accessosaurusrex

Registered User.
Local time
Today, 03:32
Joined
Oct 18, 2010
Messages
28
Here is what I want to happen:

Uncheck a check box that changes a value from -1 to -0 in a field. When that happens, I want a (now) date/time filled in to a field of that record. I am willing to use two clicks to make this happen if needed as the user will be working off a form, and I can place a "are you sure you want to do this" message in to help cover the two clicks.

My thought process was that when a checked box was unchecked, the user would be promted with the ol "are you sure?" which would go to yes which would be a macro that would insert the date/time of now into the appropriate field of the record, however, I have not been successful. Any ideas would be greatly appreciated. My programming skills are few and far between but I am a willing student.

If there is an easier path please let me know. Thanks in advance!
 
Something like this in the Before Update event of the check box

Code:
Private Sub YourCheckBox_BeforeUpdate(Cancel As Integer)
 
Dim strMsg As String
 
strMsg = "Are you sure you want to update this record?"
 
If Me.YourCheckBox = False Then
    If MsgBox(strMsg, vbYesNo + vbInformation, "Update Record?") = vbYes Then
        Me.YourOtherField = Now
    Else
        Cancel = True
    End If
End If
 
End Sub
 
Perfect! Had to play with it a smidge but is great! Thank you very much!
 

Users who are viewing this thread

Back
Top Bottom