Connecting Tech Pros Worldwide Help | Site Map

Using a subroutine to populate a field in Access - how to tie to field?

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 12th, 2005, 06:41 PM
Blake Patterson
Guest
 
Posts: n/a
Default Using a subroutine to populate a field in Access - how to tie to field?

I have a subroutine I want to run whenever an Access record is
updated.

Sub Form_BeforeUpdate(Cancel As Integer)
Me!LastUpdated = Now
End Sub

It updates this date field with the current date whenever a record is
changed. How do I tie this sub to the field in Access, so that it
fires on change?

Thanks.




bp

  #2  
Old November 12th, 2005, 06:42 PM
Allen Browne
Guest
 
Posts: n/a
Default Re: Using a subroutine to populate a field in Access - how to tie to field?

Access does not have triggers, so you cannot achieve this at the
table-level.

The code you have is the right approach, provided all changes are made
through the form.

--
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.

"Blake Patterson" <blake@blakespot.com> wrote in message
news:90552177.0401291405.63d5ed8f@posting.google.c om...[color=blue]
> I have a subroutine I want to run whenever an Access record is
> updated.
>
> Sub Form_BeforeUpdate(Cancel As Integer)
> Me!LastUpdated = Now
> End Sub
>
> It updates this date field with the current date whenever a record is
> changed. How do I tie this sub to the field in Access, so that it
> fires on change?[/color]


  #3  
Old November 12th, 2005, 06:42 PM
Pieter Linden
Guest
 
Posts: n/a
Default Re: Using a subroutine to populate a field in Access - how to tie to field?

blake@blakespot.com (Blake Patterson) wrote in message news:<90552177.0401291405.63d5ed8f@posting.google. com>...[color=blue]
> I have a subroutine I want to run whenever an Access record is
> updated.
>
> Sub Form_BeforeUpdate(Cancel As Integer)
> Me!LastUpdated = Now
> End Sub
>
> It updates this date field with the current date whenever a record is
> changed. How do I tie this sub to the field in Access, so that it
> fires on change?
>
> Thanks.[/color]

if you want the date the *Field's* value was last changed, then put it
in the AfterUpdate of the field's control.
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.