Skip to content
Advertisement

If a combo box = specific text then display in text box current date

If a combo box = Closed, rejected or cancelled then display today’s date in text box.

for example I have a combo box that has closed open rejected and cancelled. If someone chooses closed rejected or canceled then I need a text box to display the current date.

I tried the below code but not sure where to put it.

=IIf([status_box]="Closed",Date(),"")

Advertisement

Answer

It would be as ControlSource for that textbox:

=IIf([status_box]="Closed" Or [status_box]="Rejected" Or [status_box]="Cancelled",Date(),Null)

Edit:

Use the AfterUpdate of the combobox:

Dim Status As String

Status = Nz(Me![Status_box].Value)

If Status = "Closed" Or Status = "Rejected" Or Status = "Cancelled" Then
    Me!ConclusionDate.Value = Date()
Else
    Me!ConclusionDate.Value = Null
End If
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement