473,387 Members | 1,624 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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
Nov 12 '05 #1
2 1503
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" <bl***@blakespot.com> wrote in message
news:90**************************@posting.google.c om...
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?

Nov 12 '05 #2
bl***@blakespot.com (Blake Patterson) wrote in message news:<90**************************@posting.google. com>...
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.


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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Santosh | last post by:
Hello all, I am trying to interface c++ and fortran, the fortran code is already there and I was successful in calling the subroutines and functions, but was not able to send the fortran module...
9
by: Colin McGuire | last post by:
Hi, I have an report in Microsoft Access and it displays everything in the table. One column called "DECISION" in the table has either 1,2, or 3 in it. On my report it displays 1, 2, or 3. I want...
19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
2
by: Mark | last post by:
I am attempting to populate several textbox controls from VBA code. With each attempt, I get the following error: "The macro or function set to the BeforeUpdate or ValidationRule property for...
3
by: Al | last post by:
I want to populate a variable, MaxID, with the highest ID in the PROJECT table. The ID field is an Integer. I want to add 1 to MaxID, place a text prefix on it of "PM" and insert it back into the...
5
by: Eric Goforth | last post by:
Hello, I have a generic subroutine that I pass an object and fieldname as arguments. The subroutine then uses reflection to search for the value of the fieldname. For example: 'Calling...
21
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most...
3
by: aine_canby | last post by:
I have a class which has a member which takes a long time to populate. Some of this member is serialised with an xml file, and some is established through a set of commands issued on the system....
4
by: JHite | last post by:
I am using Access 2003 on Windows XP. This is a simple database that contains “tblStaffers” containing names of the office staffers, “tblProjects” containing names of the office projects, and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.