change field value on form based on another

N

norm

I have a form that displays New Vehicle Inventorty in stock, it is called
STATUS, and it will diplay "N" for NEW what I would like to do is, when the
STATUS Field changes N to A (for ACTIVE), I would like to fill in a field in
my form with TODAY'S DATE. The vehicle would stay "A"ctive for years, but on
the end of it's lifecycle it will change to "R"elinquished, but I need to
preserve the in-service date, so I only need the field to change when STATUS
is changed to A. I hope I explained this correctly.
Thank you all for your time.
 
J

Jeff Boyce

Norm

So you'd need to have Access check each time that control is updated to see
if the update was "A". If it was, Access would need to add today's date
into another control. That should be fairly straightforward... but!

If someone sets a record to "A" last week, then someone else sets it back to
"N" on Monday, and you set it back to "A" again yesterday, do you really
want yesterday's date in the other field? You might need to figure out how
you'll handle "corrections".

You can add an Event Procedure to the control's AfterUpdate event, looking
something like:

If Me!Status = "A" Then
Me!InServiceDate = Date()
Else
Me!InServiceDate = Null
End If

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
N

norm

Thank you very much Jeff!
that works perfectly!
but I need to save the inservice date. in other words when "N" turns to "A"
give me the inservicdate, now when the vehicle has finished it's lifecycle
it will become "R" for relinquished, "D" for Destroyed and few other codes
we use, but I do not want to change the inservecedate, only when STATUS
turns to "A" give me the date ignoring the rest.

Thank you so much for your time!
 
J

Jeff Boyce

Norm

I must have misunderstood. I thought you actually already had a field in
your table to hold [InserviceDate]. If you don't, add one.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
N

norm

I do have the filed InService date abd all works fine, but I did not explain
myself, when it chages to "A" it adds the date - PERFECT! now when the
vehicle is "R"elinquished, I still need to leave the InService Date as it
was when it was "A"ctive. So when the vehicle goes from "N"ew to "A"ctive,
change the inservice date, now the vehicle is being junked or transferred we
I change the status to "R"elinquished "C"ondemmended, etc.. but I need to
preserve the InService date as "A"ctive, or the vehicle's birthday sort of
speak.
Thanks for your time
 

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

Top