Microsoft Access Date

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

iam7617115

Thread Starter
Joined
Jan 13, 2003
Messages
9
The database i am making is for the counseling office of my school to document special education students. Well i need a code that will update the date everytime a record is edited. I need it to show up on a form and also on a report. Maybe in some text box on the form that will update itself everytime the record is edited/changed. Can anyone help? please?? :confused:
 
Joined
Jul 29, 2001
Messages
21,334
Make a hidden text box with the default value of =Date(), every time a record is added or edited with this form it will update a date field in your table.
 
Joined
Oct 13, 2000
Messages
941
No, the text box needs to be bound to the field in the form where you want to save the date, so it can't use a control source of =Date() or it won't save anything!

Say your date field is called DateStamp. You run a macro from the BeforeUpdate event of the form. Use the SetValue action, and set that DateStamp field to =Date() if you want today's date, or =Now() if you want today's date and the current time.

That will reset the date/time every time any change is made to the record.
 

iam7617115

Thread Starter
Joined
Jan 13, 2003
Messages
9
dang i tried doing what you said but i'm not totally sure if i did it right.. i have to bound it obviously to the date edited field in the table.. so thats where the information gets saved too.. but i dont understand the before update part of the form.. what do you mean? and i hid the Date Field in the form would that be a problem?
 
Joined
Oct 13, 2000
Messages
941
Well, binding it to the field is correct. Hiding it is fine. Now you need a macro--if you don't know what that is, I'd suggest reading the introduction in Access help, or taking a look at the Relational Database Design Resource Center--and you should assign it to the Before Update event of the form, which you can see by opening the form in design view, opening its properties window, and scrolling down until you see Before Update. The name of the macro should go there.
 

iam7617115

Thread Starter
Joined
Jan 13, 2003
Messages
9
i tried that and it wouldnt work.. the setvalue is set to Item =Date() andthe Expression is =Date() and it still wont work.. ehh need help.. ahh sorry for the trouble
 
Joined
Oct 13, 2000
Messages
941
As I have (now) explained via PM:

Item should be Forms!MyForm!MyControl, and not the Date() function, otherwise the SetValue macro is being called to say "set today's date equal to today's date", which doesn't have much to do with a field in a table.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Members online

Top