Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatically enter current date when select field in combo box 2

Status
Not open for further replies.

reddb43

Technical User
Jan 16, 2002
11
0
0
US
I have a combo box named STATUS in a form named TASK LIST with a dropdown selection to select either O, for open, or C for closed. The problem I am having is that I have been trying to use the IIF statement in another field called COMP DATE. This field is formatted mm/dd/yyyy. I am trying to use the IIF statement when I select C in the STATUS field that it automatically put the current date in the COMP DATE field. I tried several variations of the IIF statement in event on enter properties of the COMP DATE field =IIF([STATUS]=”C”, date(),””) . This did not get me anywhere. Both of these field names is on the same form. Have any suggestions?
 
How are ya reddb43 . . .

[ol][li]Remove the code you have for [blue]Comp Date[/blue].[/li]
[li]In the [blue]AfterUpdate[/blue] event of [blue]Status[/blue] copy/paste the following:
Code:
[blue]   If Me!ComboboxName.Column(1) = "C" Then
      Me![CompDate] = Date
   Else
      Me![Comp Date] = ""
   End If[/blue]
[/li][/ol]

Calvin.gif
See Ya! . . . . . .
 
I copied and put the code in afterupdate just like you said. Nothing happened. The field stayed blank even after I selected C in STATUS field. This is what I changed in the code for the name of the combobox name.

Private Sub STATUS_AfterUpdate()
If Me.STATUS.Column(1) = "C" Then
Me![Comp Date] = Date
Else
Me![Comp Date] = ""
End If
End Sub
 
reddb43 . . .

You may have to play with the column index [blue]Column([purple]x[/purple])[/blue]. Column index starts at zero and includes any columns set to zero in the [blue]Column Widths[/blue] property . . .

Calvin.gif
See Ya! . . . . . .
 
Thanks for the information, this worked out great. I changed the colum index to zero and it did what I needed it to do. thanks a lot.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top