Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2004
    Location
    New York
    Posts
    2

    Cool Unanswered: Access Date Update Field Help

    Can someone help a poor programming illiterate soul?

    I'm building an Access Database and I am trying to create a Date field on a form that updates with the current date whenever a record is updated with information.

    I a quick sense, I was trying to set the field in the form so that it's default value would be the current date whenever a new record is made.

    The same field would also update to the current date whenever it is clicked on by the mouse at a later time.

    Any idea how to get this to work?

    Thanks,
    DB

  2. #2
    Join Date
    Feb 2004
    Location
    Wales
    Posts
    343
    Hi

    OK - I'm assuming that you still have to create the date system.

    1. In the table where the date is to be stored, place a new field (well call it DATE). Set the data type to Date/time - In the General secton at the base of the window place in the DEFAULT VALUE =date()

    save the table

    Go to the macro wizard and create a macro - (save something like Date_Adjuster)

    In the section "Macro Name" date the macro DATE

    In the ACTION Colum select SETVALUE

    In the ITEM section place [Forms]![YourFormName]![date]
    In the EXPRESSION section place DATE() ------ DONOT place an equals symbol

    SAVE The macro

    BACK TO THE FORM THAT CONTAINS THE DATA AND DATE FIELD

    In the form where the date is to be entered create a TEXT BOXeasiest way if the form already exists is to drag and drop from the Field List.



    In the text boxes Properties, set the section ON CLICK to the macro name Date_Adjuster.DATE

    Save the form

    Go to the Properties of the testbox where the data may need to change and select the ON UPDATE section and then choose the same macro, Date_Adjuster.DATE

    Save the form.

    the first macro you set mean that when you click the date box it will change to todays date, if you update the text box with the data in the date will change to todays date
    This way either operation will achieve what you wanted and keep the process simple


    hope that helps

    regards
    gareth

  3. #3
    Join Date
    Apr 2004
    Location
    Kingsland, Georgia
    Posts
    231

    Re: Access Date Update Field Help

    Originally posted by Dbnyack
    Can someone help a poor programming illiterate soul?

    I'm building an Access Database and I am trying to create a Date field on a form that updates with the current date whenever a record is updated with information.

    I a quick sense, I was trying to set the field in the form so that it's default value would be the current date whenever a new record is made.

    The same field would also update to the current date whenever it is clicked on by the mouse at a later time.

    Any idea how to get this to work?

    Thanks,
    DB
    I've got a similar thing on a form I've written. When the supervisor clicks the task as being complete, it records their login name and the date and stores those in invisible text boxes. all you have to do is have a textbox on your form (visible or invisible) that is bound to the date field in your database table. then, when the user clicks the button or checkbox or however they indicate they are changing a record (maybe on the afterupdate event), you'd just put
    Code:
    If .Value = True Then
       me.txtDate = Now()
    End If
    that will put the current time and date into the checkbox, and since it's bound to your table, the data will go into the table.

    hope this helps.

  4. #4
    Join Date
    Feb 2004
    Location
    Wales
    Posts
    343
    If you change the Now() to Date() it will remove the Time stamp which may no be required.


    code:--------------------------------------------------------------------------------
    If .Value = True Then
    me.txtDate = Date()
    End If
    --------------------------------------------------------------------------------


    G....

  5. #5
    Join Date
    Apr 2004
    Location
    New York
    Posts
    2
    OMG...This is great! You guys are the best. Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •