473,396 Members | 2,158 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,396 software developers and data experts.

Date Update!

I can't out figure what I've missed out or done wrong!! I have a
database which has a 'Last Update' field. This field has a general of
Short date & Default Value: Date(), which works well when a new record
is input, but when that record is updated by a user, say the next day,
the date isn't changing to the new date. I have tried with the
Default value as Now() and even created a new field for this to see if
there is any change, but nothing is changes.

Can anybody please throw some light on as to how I can get the date to
change to the date data is changed??

Thank you in advance

Trish
Nov 12 '05 #1
7 1717
Access cannot do this at the table level.

However, if your updates are made through a form, you can use the
BeforeUpdate event procedure of the form:

Private Sub Form_BeforeUpdate(Cancel As Integer)
Me![Last Update] = Now()
End Sub

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

"TrisH" <Tr**********@yahoo.co.uk> wrote in message
news:de************************@posting.google.com ...
I can't out figure what I've missed out or done wrong!! I have a
database which has a 'Last Update' field. This field has a general of
Short date & Default Value: Date(), which works well when a new record
is input, but when that record is updated by a user, say the next day,
the date isn't changing to the new date. I have tried with the
Default value as Now() and even created a new field for this to see if
there is any change, but nothing is changes.

Can anybody please throw some light on as to how I can get the date to
change to the date data is changed??

Thank you in advance

Trish

Nov 12 '05 #2
TrisH wrote:
I can't out figure what I've missed out or done wrong!! I have a
database which has a 'Last Update' field. This field has a general of
Short date & Default Value: Date(), which works well when a new record
is input, but when that record is updated by a user, say the next day,
the date isn't changing to the new date. I have tried with the
Default value as Now() and even created a new field for this to see if
there is any change, but nothing is changes.


DefaultValue applies only when the record is newly created. And since
Access (or Jet, the database engine) does not provide triggers, that is
some procedures that run on certain table events, you cannot fully have
this.

However, if all your table manipulation by users is through forms, you
can use the AfterUpdate event of the form to set the date field.

--
Bas Cost Budde
http://www.heuveltop.org/BasCB
but the domain is nl

Nov 12 '05 #3
Allen Browne wrote:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Me![Last Update] = Now()
End Sub


Aw, I said AfterUpdate, but that is bound to fail...

Addition: you can shake the square brackets if you don't use spaces in
object(field, table, form, query, report...) names.

--
Bas Cost Budde
http://www.heuveltop.org/BasCB
but the domain is nl

Nov 12 '05 #4
Bas Cost Budde <ba*@heuveltop.org> wrote in news:c055r9$umj$5
@news2.solcon.nl:
Addition: you can shake the square brackets


Is this some Salvation Army ritual?

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #5
Lyle Fairfield wrote:
Addition: you can shake the square brackets


Is this some Salvation Army ritual?


No, but it can be seen with Morris dancers.

--
Bas Cost Budde
http://www.heuveltop.org/BasCB
but the domain is nl

Nov 12 '05 #6
Bas Cost Budde <ba*@heuveltop.org> wrote in message news:<c0**********@news2.solcon.nl>...
Allen Browne wrote:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Me![Last Update] = Now()
End Sub


Aw, I said AfterUpdate, but that is bound to fail...

Addition: you can shake the square brackets if you don't use spaces in
object(field, table, form, query, report...) names.


I've tried the above, but it still isn't updating with both the before
update & after update. I have made a form for the table concerned,
but it's still not playing. Is the bit in brackets case sensitive?
Nov 12 '05 #7
TrisH wrote:
I've tried the above, but it still isn't updating with both the before
update & after update. I have made a form for the table concerned,
but it's still not playing. Is the bit in brackets case sensitive?


No, it isn't.
Please make sure the event really fires. You can set a breakpoint (press
F9 with the cursor on the =Now line) or put an extra line with MsgBox
"Hello" in the procedure; try editing; do you get at that spot?

If no: is the AfterUpdate (no, BeforeUpdate) *property* of the form set
to [Event Procedure]?
--
Bas Cost Budde
http://www.heuveltop.org/BasCB
but the domain is nl

Nov 12 '05 #8

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

Similar topics

1
by: jt | last post by:
I posted this yesterday, but I am not seeing this out yet: I am having problems with updating a date field in a certain format. The data is stored in an Oracle database. The date is...
3
by: BlackFireNova | last post by:
This concerns an Access 2002 (XP) database. There are two fields, "Notes" (Memo Field) and "Notes Update" on a form (among others) which I am concerned with here. Problem: I need to be able...
3
by: Mike Dundee | last post by:
I am importing data into a new database (the database still has to be set up) and have a problem. The comma delimited text files I am importing have four fields containing date and date/times. ...
7
by: Nicolae Fieraru | last post by:
Hi All, I have a table tblProducts where I have four fields:\ Index, ProductName, EnterDate (as Date/Time - Medium Date), PurchaseDate (Date/Time - Medium Date) The EnterDate is automatically...
5
by: m_t_hill | last post by:
Running MS Access 2000 MS Windows XP Pro This has caused me a lot of hair loss in the last few days so would appreciate any help. I am running code to append/update a local access database...
1
by: Riley DeWiley | last post by:
I have an UPDATE query that is always setting 0 records. When I cut and paste the SQL into Access and use it, it fails in the same way unless I coerce the date fields to be '=now()', in which case...
2
by: syntego | last post by:
We commonly use triggers to log changes to our main tables to historical log tables. In the trigger, we create a concatenated string of the old values by casting them as follows: ...
0
by: Sambhav | last post by:
Hi I am using MS sql right now I m felling up the data into the database using a software called DTM data generator so my problem is I have filled all the dates in 4 different columnsin a single...
1
by: Sambhav | last post by:
Hi I am using MS sql right now I m felling up the data into the database using a software called DTM data generator so my problem is I have filled all the dates in 4 different columnsin a single...
30
by: fniles | last post by:
On my machine in the office I change the computer setting to English (UK) so the date format is dd/mm/yyyy instead of mm/dd/yyyy for US. This problem happens in either Access or SQL Server. In the...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.