mercredi 9 janvier 2019

MS-Access Checkbox = Now() On Click ; Uncheck = Null?

I'm designing a task order db that has a lot of checkboxes and instead of creating Yes/No fields it was decided to use Date fields that use Checkboxes on the Forms to set said dates using the = Now() function:

Private Sub DXF_Chk_Click()
dxfLimits = Now()
End Sub

However, if someone unchecks the checkbox the date just updates and in our Reports the boxes remain checked.

My thought was to write a code that checks to see if the Date field has been filled and Null it On Click but that's not working:

If Me.DXF_Chk = 1 Then
  Me.dxfLimits = Now()
 Else
  Me.dxfLimits = Null
 End If

Or leave the current On Click alone and use some code in the After_Update event. I'm not sure which is proper protocol, nor what I'm doing wrong in the code itself.

Sorry, I'm a noob.




Aucun commentaire:

Enregistrer un commentaire