1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Microsoft Access Date

Discussion in 'Business Applications' started by iam7617115, Jan 13, 2003.

Thread Status:
Not open for further replies.
Advertisement
  1. iam7617115

    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:
     
  2. Rockn

    Rockn

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

    downwitchyobadself

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

    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?
     
  5. downwitchyobadself

    downwitchyobadself

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

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

    downwitchyobadself

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

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 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/113124

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice