Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Imbedded Macros

Geek News

Imbedded Macros
NEC-2008 12/14/2008 2:34:01 AM
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.
Re: Imbedded Macros
"Allen Browne" <AllenBrowne[ at ]SeeSig.Invalid> 12/14/2008 3:12:01 AM
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
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"NEC-2008" <americanviewer[ at ]yahoo.com> wrote in message
news:FEFEF4F5-86A4-47FC-853C-7C818CF0A888[ at ]microsoft.com...
[Quoted Text]
> 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.

Re: Imbedded Macros
"Mike Painter" <mddotpainter[ at ]sbcglobal.net> 12/14/2008 5:19:29 AM
NEC-2008 wrote:
[Quoted Text]
> 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.
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.


Re: Imbedded Macros
NEC-2008 12/14/2008 3:21:00 PM
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" wrote:

[Quoted Text]
> 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
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "NEC-2008" <americanviewer[ at ]yahoo.com> wrote in message
> news:FEFEF4F5-86A4-47FC-853C-7C818CF0A888[ at ]microsoft.com...
> > 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.
>
>
Re: Imbedded Macros
NEC-2008 12/14/2008 3:29:00 PM
Mr. Painter, Thanks for the suggestion.

"Mike Painter" wrote:

[Quoted Text]
> NEC-2008 wrote:
> > 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.
> 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.
>
>
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net