linking yes/no with a date

B

Buckaroo

I have two fields, one with a yes/no type field, the other with a date/time
type field.

I am trying to time stamp a piece of data when I click a yes/no option box
with todays date?

Please can you tell me how to do it!
 
6

'69 Camaro

Hi.

In the check box's OnAfterUpdate( ) event, assign today's date to the
control bound to the Date data type field. For example:

Private Sub chkDone_AfterUpdate()

On Error GoTo ErrHandler

Me!txtDateDone.Value = Date

Exit Sub

ErrHandler:

MsgBox "Error in chkDone_AfterUpdate( ) in" & vbCrLf & _
Me.Name & " form." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & Err.Description
Err.Clear

End Sub

.. . . where chkDone is the name of the check box and txtDateDone is the name
of the text box bound to the Date data type field.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.
 
K

Ken Snell [MVP]

In your form, use the AfterUpdate event of the control that is bound to the
"yes/no" field to write the current date/time into the control that is bound
to the date/time field:

Private Sub YesNoControlName_AfterUpdate
Me.DateTimeControlName.Value = Now()
End Sub
 
R

Rick Brandt

Buckaroo said:
I have two fields, one with a yes/no type field, the other with a
date/time type field.

I am trying to time stamp a piece of data when I click a yes/no
option box with todays date?

Please can you tell me how to do it!

If the absence of a date entry always corresponds to a False value in the Yes/No
field and the presence of a date entry always corresponds to a True entry in the
Yes/No field then the Yes/No field is redundant and should be eliminated.
 
Top