Input current date based on list box choice

  • Thread starter Thread starter Michael West
  • Start date Start date
M

Michael West

Hello,

I don't think this will be too challenging for some of you.
I have a form where the user selects a value in a list box.
Based on the choice, I want to programmatically insert the
current date in one of several possible date fields. These
date fields are in the same table and are displayed on the
same form as the list box.

So:

If user selects value A
insert current date in "A Date" field
If user selects value B
insert current date in "B Date" field
etc.

(Those aren't the real field names, by the way).

Could somebody suggest the code I need, and which
event it should be tied to?

Thank you.
 
I said:
Could somebody suggest the code I need, and which
event it should be tied to?


I just realized something else -- the current date
should only be inserted after the user presses a
"Save" button -- not immediately as soon as the list
box selection is made.

This is because they might accidentally choose one
value and then come back and correct it, and I only
want to use the final choice to decide which date
field to update.
 
Michael said:
I just realized something else -- the current date
should only be inserted after the user presses a
"Save" button -- not immediately as soon as the list
box selection is made.

This is because they might accidentally choose one
value and then come back and correct it, and I only
want to use the final choice to decide which date
field to update.


So I guess what I need to do is, when the user clicks
the "Save" button, compare the selected value
in the list box to see if it is different from what
is in the table. If it is, then I update the appropriate
date field, and if it's not changed, then I don't do anything.

(Wish I'd have thought this through more before posting!)
 
Back
Top