Value in a Form Question

P

Pass-the-reality

I have a form (frmDocumentDataASO) that contains two fields Status and
Completion. Status is a drop down field. When the status "Complete" or
"CompleteDeem" is selected, I want the Completion field to default to todays
date. Is there anyway to build an expression in the default value for the
Completion field? What are my options?
 
G

George Nicholson

(In cboStatus_AfterUpdate)

If Me.NewRecord Then
Select Case Me.cboStatus
Case "Complete", "CompleteDeem"
Me.txtCompletion = Date()
Case Else
'Do Nothing
End Select
End If

If you want Completion filled in as above even if its an existing record,
remove the 2 If..Then and EndIf lines.

I don't think DefaultValue will do what you want in this case because it
would apply to all newly created records regardless of what is or isn't done
with cboStatus. If you wait until cboStatus is changed to set DefaultValue,
I don't think it will effect the current record since the record has passed
the creation stage (although not yet saved/commited).
 
Top