megatronixs
Registered User.
- Local time
- Today, 02:43
- Joined
- Aug 17, 2012
- Messages
- 719
Hi all,
I have a 2 columns that needs to be filled in with a date.
recently the status changed, but this should not impact the rest of the idea.
If there is a status already filled in, and the user changes to "Approved - Awaiting Consent" or "Approved - Awaiting Documents" then it should fill in the date in the column "stop_status" and if the status changes to other that are not equal to the 2 above, a date should be filled in column "status_go_on"
I wanted to creat a function for this, but got lost with the Select Case.
I created the below code that is trigered by a person changing the status, but it could be also be updated in the morning on the table and then it would be missed.
The code will not always work and I can't find where it goes wrong even by running the code step by step.
basically, it should check the date if it is blank in the first column "status_stop" if empty, then fill it in. then, when another status is changed and is not equal to the 2 above and the first column is not empty, fill the date in the column "status_go_on", if both are filled in, they should be skiped to avoid that a date is filled in again and change the last date and so ruin the calculations.
Greetings.
I have a 2 columns that needs to be filled in with a date.
recently the status changed, but this should not impact the rest of the idea.
If there is a status already filled in, and the user changes to "Approved - Awaiting Consent" or "Approved - Awaiting Documents" then it should fill in the date in the column "stop_status" and if the status changes to other that are not equal to the 2 above, a date should be filled in column "status_go_on"
I wanted to creat a function for this, but got lost with the Select Case.
I created the below code that is trigered by a person changing the status, but it could be also be updated in the morning on the table and then it would be missed.
Code:
Private Sub combo_status_AfterUpdate()
If (Me.combo_status = "Approved - Awaiting Consent" Or Me.combo_status = "Approved - Awaiting Documents") And IsNull(Me.status_stop) Then
Me.status_stop = Date
End If
If Not IsNull(Me.status_stop) And (Me.combo_status <> "Approved - Awaiting Consent" Or Me.combo_status <> "Approved - Awaiting Documents") And IsNull(Me.status_go_on) Then
Me.status_go_on = Date
End If
End Sub
basically, it should check the date if it is blank in the first column "status_stop" if empty, then fill it in. then, when another status is changed and is not equal to the 2 above and the first column is not empty, fill the date in the column "status_go_on", if both are filled in, they should be skiped to avoid that a date is filled in again and change the last date and so ruin the calculations.
Greetings.