linking yes/no with a date

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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!
 
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.
 
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
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top