Discussion Locked

Ms Access refresh field

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
how to refesh a field that indicate the latest date when the data was modified on a specific form (record)was done

6 replies

by sgt_shultz

have you tried attaching a refresh macro to the After Change event on each field? or does that take too long? tell us more about exactly how you want this to work

by pina

yes I have over 100 fields and attaching a macro is a tedious operation, anything faster?

by timfox

Let's say that your form (and probably the underlying record, as well) has a field called txtLastUpdatedDate where you want to display the last updated data value.

--> What
Decide when you want to update the value
1. Each time a value is changed on the form
2. Each time a field value is modified
3. Each time the form is closed
4. Each time the record is saved

-->When
For each choice, you are choosing a different event to put your next bit of code in, as follows:
1. Each time a value is changed on the form
- OnChange
2. Each time a field value is modified
- AfterUpdate
3. Each time the form is closed
- OnClose
4. Each time the record is saved
- Depends on implementation, but whenever you actually perform the save operation.

-->How
If you are storing a LastUpdateDate value against the recordset and if you are binding the fields directly to the datasource, then do this:
txtLastUpdatedDate = Now()
...and let Access actually put the value into the record, per normal record saving.
If you are saving the data to the database record directly, then within your With recordset bundle, use:
!LastUpdateDate = Now()

Notes
1. On loading the form, upload the field as you would populate the other fields.
2. Use 'Date()' instead of 'Now()' if you just want the date without the time value.

This discussion is closed to new replies.