pdvsa
asked on
Update to today's date
Experts, the below code is my code and I know it is wrong.
I think you can see what I am trying to do.
I need to update txtDateCompleted to today's date.
thx
Private Sub txtCompleted_AfterUpdate()
If Me.txtDateCompleted = "" Then
Me.txtDateCompleted = Date
Else
End If
End Sub
I think you can see what I am trying to do.
I need to update txtDateCompleted to today's date.
thx
Private Sub txtCompleted_AfterUpdate()
If Me.txtDateCompleted = "" Then
Me.txtDateCompleted = Date
Else
End If
End Sub
Have you tried date()
Private Sub txtCompleted_AfterUpdate()
If Me.txtDateCompleted.Value = "" Then
Me.txtDateCompleted.Value = Date()
Else
End If
End Sub
If Me.txtDateCompleted.Value = "" Then
Me.txtDateCompleted.Value = Date()
Else
End If
End Sub
ASKER
Lee that's not it either.
I probably named txtCompleted incorrectly (I just noticed this actually). It is a value list combo box with value Yes or No.
maybe that changes something?
I probably named txtCompleted incorrectly (I just noticed this actually). It is a value list combo box with value Yes or No.
maybe that changes something?
No points please!
How about:
1. Changing the name of the combo box to cboCompleted
2. Changing the AfterUpdate event to:
How about:
1. Changing the name of the combo box to cboCompleted
2. Changing the AfterUpdate event to:
Private sub cboCompleted_AfterUpdate()
Me.txtDateCompleted = iif(NZ(me.cboCompleted, "") = "Yes", Date(), NULL)
End Sub
This will make the DateCompleted NULL if cboCompleted is anything other than "Yes" and todays date if it is "Yes"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you. It was an education and I hopefully will retain it.
:)
:)