field type - date/time

Icarus84

Registered User.
Local time
Tomorrow, 01:22
Joined
May 14, 2013
Messages
17
hy,
i have a table with the following field names ( id client , address, e-mail, phone, fax) and a form. Because this form is used by 10 persons i need to know if one of them has modify the info's from an old client (i need just the moment when it was made the intervention and not the user). I tried to use another field with the format 'data' and to 'Default value' to select 'Now()' but it takes the time from the moment when a new client is introduces in the table and remain unchainge if someone modifies an old field. Please help me with another idea.
Thank you
 
Write Now() to the field using the BeforeUpdate event of the Form. This will be updated as the record saves.
 
Thank you for your replay, but in that field 'BeforeUpdate' i need a formula to fill the field 'Modify date' with the year/month/day/hour/min/sec (i think a VBA code or a Macro).
by
 
In the form's Before Update event simply use;
Code:
Me.YourFieldName = [URL="http://www.techonthenet.com/access/functions/date/now.php"]Now()[/URL]
This will update that field with the current time and date whenever you update the current record.
 
I don't receive any error but when i open the table to see if the field has received the date it is empty (i use Access 2003 - maybe this is the reason?)
 
You must save the record on the form by moving to another record or colsing the form before it will write to the table.
 
I updated the fields from the form with the code to Before Update and i receive the error : Can't find Macro 'Me' this because i use Access 2003?
 
What you need to do is put your form in design view. Ensure you are dealing with the form properties. You will see a small black square in the box at the junction of the vertical and horizontal rulers when you are.

attachment.php


Now select the Event tab on the property sheet, and go to the Before Update event and select event procedure from the drop down list.

attachment.php


Click the ellipsis (that's the little button with the three full-stops on it), this will open up the code window.

attachment.php


Now start typing the code as previously presented, when you hit the full stop after Me you will get a list of all the available fields, select the appropriate field and finish the code. Now go back to the form, save your changes and put it back into form view. The code should now work when you make changes to any field on the form and move to another record.
 

Attachments

  • Capture.PNG
    Capture.PNG
    8.5 KB · Views: 293
  • Capture2.PNG
    Capture2.PNG
    3.8 KB · Views: 289
  • CaptureA.PNG
    CaptureA.PNG
    5 KB · Views: 281
THANK YOU VERY MUCH
ITS WORKING (I recreate the form) perfectly
thx1000000000
 
Hy
Please help me with another problem: i have creeated the field for userid (the database is protected with user and password) and i need to know how i can connect the previous code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Me.Modifydate = Now()
End Sub
with :
Me.User = CurrentUser
to write in the field User the ID of the person who modify the fields.
thanks
 
Last edited:

Users who are viewing this thread

Back
Top Bottom