Solved Add date when particular field updated (1 Viewer)

ClaraBarton

Registered User.
Local time
Yesterday, 20:45
Joined
Oct 14, 2019
Messages
451
I have a form that shows the date a record was created.
Before updating I have a date field for when a record was modified.
Now I'd like to automatically add the date when a rep takes over a client. This would be when a rep ID is added to the record from a combo box.
I don't want this date to change when the record is modified in any other way. How would I do this?
 

moke123

AWF VIP
Local time
Yesterday, 23:45
Joined
Jan 11, 2013
Messages
3,912
In the after update event of the combobox, test if your date field is null. If it is null add the date. if it is not null do nothing.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 22:45
Joined
Feb 28, 2001
Messages
27,140
There are events associated with individual controls. The way I would approach this is:

With knowledge that you are looking for a change of clients, I would have the current "client of record" recorded in a variable during the Form_Current routine. Then, in the particular combo box, I would use either the _Click or _LostFocus routine to compare the current value of the variable vs. the current value of the control. IF they don't match, load up your new date. If they are the same, do nothing.

EDIT: And Moke123 would use _AfterUpdate. Tomato - tomahto.
 
Last edited:

ClaraBarton

Registered User.
Local time
Yesterday, 20:45
Joined
Oct 14, 2019
Messages
451
Thank You!!! I didn't think about the combo properties.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 04:45
Joined
Sep 12, 2006
Messages
15,634
It's always tricky. If a user changes the combo choice, you record the change, and then the user presses Esc to undo the change, can you unwind your change record?
 

Users who are viewing this thread

Top Bottom