Macro Not Triggering After Update Event

B

Balfour211

I am using Access 2003. I have set up a Macro to automatically enter the
Current Date into my txtDate control by just double clicking on the control.
I use the Set Value procedure in a Macro to accomplish it. It works fine on
getting the date into the control. The problem is that the Macro does not
trigger the After Update event. I have several things I want to change once
the date is entered.

Note: This program is set up with a main table with several related tables.
I have it set up so the date is the only thing they can enter when entering
a "New" record. I do not want them to enter data into the related tables
until the main record is started. That way they will have a record to
"attach" to. Once the date is entered, all other subforms and controls are
enabled (or become visible). I use the After Update event to accomplish
this.

Any suggestions would be appreciated
Thanks in advance,
Balfour211
 
D

Douglas J. Steele

Unfortunately, changing values programmatically is not seen as updating from
an Event perspective. (it's the same way when using VBA)

If you were using VBA, you could simply call the AfterUpdate procedure. I'm
not really sure what your options are using Macros.
 
A

Al Campagna

Balfour211,
Why have a macro just to set a date value. Why not just...
Private Sub SomeDate_DblClick(Cancel As Integer)
SomeDate = Now() 'or Date()
SomeDate_AfterUpdate
End Sub
 
J

John W. Vinson

I am using Access 2003. I have set up a Macro to automatically enter the
Current Date into my txtDate control by just double clicking on the control.
I use the Set Value procedure in a Macro to accomplish it. It works fine on
getting the date into the control. The problem is that the Macro does not
trigger the After Update event. I have several things I want to change once
the date is entered.

I'd just use the RunMacro action in this macro. As Douglas says, update events
are triggered only when fields are manually updated, not when a program does
so.
 
A

Al Campagna

Balfour211,
Sorry I hit Send by mistake...

Balfour211,
Why have a separate macro just to set a date value. Why not just...

Private Sub SomeDate_DblClick(Cancel As Integer)
SomeDate = Now() 'or Date()
SomeDate_AfterUpdate ' triggers the AdterUpdate
End Sub

Just "manually" trigger the AfterUpdate event via code.
And, your original AfterUpdate is still fired if the user manually
enters the date value.
--
hth
Al Campagna
Microsoft Access MVP 2006-2009
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
B

Balfour211

Thanks for all of your help. I combined your suggestions and came up with
the RunMacro Command in VBA, and then called the txtDate_AfterUpdate event
with code. It works great.

I was unaware you could get the AfterUpdate event and all the other events
to trigger inside another event with code.

Thanks again for all the help....
Access - The More I Learn, The More I Realize How Little I Really Know.
Balfour211
 
A

Al Campagna

Balfour211,
Good deal!
I find it better to do all my coding in VB, rather than have some code
in macros, and some in modules. Since Macros are somewhat limited
in functionality, you might be well served to go all VB.
Just a personal opinion...
--
hth
Al Campagna
Microsoft Access MVP 2006-2009
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top