Date Calculation

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

Guest

Hello,

What I was trying to do, is set the date automatically when another field on
my form has been set to "yes", is it possible?

Thanks in advance
 
On the AfterUpdate event of the Yes/No field in the form you can set the Date
field to the current date

Me.[DateFieldName] =Date()

Or, if you want to include also the time, then
Me.[DateFieldName] =Now()
 
Sorry, if you want to add a criteria, to check if the field is "Yes"

If Me.[YesNoFieldName] = True Then
Me.[DateFieldName] =Date()
End If
 
Hello,

What I was trying to do, is set the date automatically when another field on
my form has been set to "yes", is it possible?

Thanks in advance

Sure.
But is the field set to "Yes" a text field or is it a check box Yes/No
field?

Code the AfterUpdate event of the field set to "Yes" (if it is a text
datatype field):
If Me![FieldName] = "Yes" Then
Me![DateField] = Date()
End If

However, if [FieldName] is a Check box Yes/No field, then use:
If Me![FieldName] = -1 Then
Me![DateField] = Date()
End If

hat do you want to happen if the user enters "Yes" and then changes it
later to "No"? Perhaps:

If Me![FieldName] = "Yes" Then
Me![DateField] = Date()
Else
Me![DateField] = Null
End If
 

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