Imbedded Macros

  • Thread starter Thread starter NEC-2008
  • Start date Start date
N

NEC-2008

Does any one know if you can attache an event (insert date in date field) to
an imbedded macro that triggers from a command button?
The command button: "Save Record"
Action wanted: Insert current date into date field in addtion to save
record.

Thanks for the help.
 
Use the BeforeUpdate event of your *form* (not control.)

Access fires Form_BeforeUpdate just before it saves the record. If you set
the form's BeforeUpdate property to:
[Event Procedure]
and click the Build button (...) beside that, Access opens the code window.
You can then assign the values, e.g.:
Me.[SomeField] = Now()

If you prefer to use a macro rather than code, use the SetValue action to
set the value of:
[Forms].[YourFormName].[YourDateFieldName]
 
Mr. Brown...Will try all of the above and get back to you.
PS...Have taking a lot of info from your website. Thanks for the reply.

Allen Browne said:
Use the BeforeUpdate event of your *form* (not control.)

Access fires Form_BeforeUpdate just before it saves the record. If you set
the form's BeforeUpdate property to:
[Event Procedure]
and click the Build button (...) beside that, Access opens the code window.
You can then assign the values, e.g.:
Me.[SomeField] = Now()

If you prefer to use a macro rather than code, use the SetValue action to
set the value of:
[Forms].[YourFormName].[YourDateFieldName]

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

NEC-2008 said:
Does any one know if you can attache an event (insert date in date field)
to
an imbedded macro that triggers from a command button?
The command button: "Save Record"
Action wanted: Insert current date into date field in addtion to save
record.

Thanks for the help.
 
Mr. Painter, Thanks for the suggestion.

Mike Painter said:
Why not set the default for the field to Date()?
Unless you start a new record before midnight and save it after this should
work.
 
Back
Top