Set date after combo box update

KolaKubism

New member
Local time
Today, 18:17
Joined
Nov 19, 2014
Messages
5
I've got an Access 2010 database based on the Tasks template.
I've added a column to the Tasks table called "CompletedDate"
I'd like for the Status combo box on the Task Details form to update the Completed Date for that record.

i.e. so when the Status is set to completed, it auto completes the Completed Date with the current date.

I've tried using an OnChange and an afterUpdate statement on the Status box but I don't seem to be getting anywhere.
Any thoughts?
 
AftyerUpdate is the right event. But you need to say what you did, show the code you used and say what the system did - "not getting anywhere " is void of any useful information.
 
Cheers, at least I know I'm heading in the right direction!

So my vba looks like this:

Private Sub txtStatus_AfterUpdate()
If txtStatus = "Completed" Then
CompletedDate = Now()
End If

End Sub

After saving, and setting a record to completed it doesn't update the CompletedDate.
There's no error shown.
 
Did you wire up the event? Ie, in the property list of the text box, in the events tab, AfterUpdat shows something?

Put
MSgBox "Hello world" inside just to verify it runs

and otherwise:

Code:
Private Sub cboStatus_AfterUpdate() * customatily, a combobox would be called cboStatus
If Me.cboStatus = "Completed" Then
    Me.CompletedDate = Date() ' Now() includes both date and time element
End If
End Sub
 
Last edited:
Thanks for the help.
I've sorted it now.
I added a text box to the form to show Date Completed, and changed the vba so it shows in that box. Works now and to be honest is better than just updating the backend table.
 

Users who are viewing this thread

Back
Top Bottom