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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Query 1
Final Status 1
Command button to open a specific record 1
Access Employee testing checklist 0
Conditional date on original Change 7
Changing Form BackColor in VB 1
detecting change in a field 2
Date Forced Popup 6

Top