Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Jan 2003
    Location
    Albury, New South Wales, Australia
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Incrementing Date Field (2000 9.0.2720)

    I have a table where each new record is required to record the date and a breakup of hours:
    eg, RecordID,Date, Admin, Exec,etc.

    I'd like the Date field to automatically increment (one day at a time) to save the user having to input each time a new record is entered. Is there a magic recipe for this? Any help would be greatly appreciated.

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Incrementing Date Field (2000 9.0.2720)

    Where do you add this record? On a form?
    The Date() function gives todays date, Now() gives the current Date and Time.
    Pat <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  3. #3
    4 Star Lounger
    Join Date
    Aug 2002
    Location
    Dallas, Texas, USA
    Posts
    594
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Incrementing Date Field (2000 9.0.2720)

    Not exactly sure what you want to do.

    If you just want the current date to show up in a field, go into the table design, and put Date() in the Default value.

    If you want to increment the date by one (say to enter several entries in one setting), then use the DMax function. This will need to be put in a form's textbox though, because you can't use DMax in a table's default value. So in the textbox's default value, put DMax("MyTableName","[MyDateFieldName]")+1

    Also, you can tell your users to use Ctrl ; for the current date and Ctrl : for the current time.

  4. #4
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Incrementing Date Field (2000 9.0.2720)

    I think Pat is on the right track - use the Date() function as the default for the field at the table level. Note that this assumes the PC clock is correct - you may want to ask the user to validate the correctness of the clock.
    Wendell

Posting Permissions

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