Last Modified

  • Thread starter Thread starter Simon Dowse
  • Start date Start date
S

Simon Dowse

Hi,

I have created a form with loads of controls on it. What
I want to do is have a control that shows the current date
whenever any of the other controls are changed.

Any ideas?
 
In the BeforeUpdate event of the form, place the date (and time if you wish)
in the control you mention. This control should be bound to a field in the
underlying table.
 
OK, so do I open the form and view the form properties and
enter the date? If so, where does Access know where to
put the date?

Or does it go in the properties for the control? In which
case it won't include when any other parts of the form are
updated.

And what if the changes are made tomorrow, how do I get it
to show whatever the current date is?
 
Ok, the BeforeUpdate event of the form will run everytime the record is
"dirty" and the form goes to save the changes. It runs Before the record is
Updated, this lets you put the date/time in first. It will work with new
records and current records that get changed.

To access the BeforeUpdate event, open the form in design view and open the
Properties sheet. On the Events tab go to BeforeUpdate and set it for [Event
Procedure]. Click the ... button and it will open the VBA editor. In the
editor you will tell Access to put the current date/time in the control on
the form. The control on the form should be bound to a date/time field in
the underlying table so that you can "remember" this information.

An example of the code would be:

'Date & Time
Me.txtNameOfTextbox = Now

'Date only
Me.txtNameOfTextbox = Date
 
Worked perfect...Thanks!
-----Original Message-----
Ok, the BeforeUpdate event of the form will run everytime the record is
"dirty" and the form goes to save the changes. It runs Before the record is
Updated, this lets you put the date/time in first. It will work with new
records and current records that get changed.

To access the BeforeUpdate event, open the form in design view and open the
Properties sheet. On the Events tab go to BeforeUpdate and set it for [Event
Procedure]. Click the ... button and it will open the VBA editor. In the
editor you will tell Access to put the current date/time in the control on
the form. The control on the form should be bound to a date/time field in
the underlying table so that you can "remember" this information.

An example of the code would be:

'Date & Time
Me.txtNameOfTextbox = Now

'Date only
Me.txtNameOfTextbox = Date

--
Wayne Morgan
MS Access MVP


OK, so do I open the form and view the form properties and
enter the date? If so, where does Access know where to
put the date?

Or does it go in the properties for the control? In which
case it won't include when any other parts of the form are
updated.

And what if the changes are made tomorrow, how do I get it
to show whatever the current date is?
bound
to a field in the wrote
in message


.
 
Back
Top