+ Reply to Thread
Results 1 to 3 of 3

Calculated field with resetting increments by time period

  1. #1
    Forum Contributor
    Join Date
    01-11-2011
    Location
    Frederick, MD, USA
    MS-Off Ver
    Excel 2007
    Posts
    125

    Calculated field with resetting increments by time period

    I'm fairly good at Excel, but brand new to Access - and I'm discovering that there are enough differences between the two that I might be worse off than someone with no knowledge at all!

    I'm looking to create a calculated field in a table that increments by date. That is, each day will have a similar results, but resets each day. For example, a bunch of records created today will have results like
    2017-11-27-001
    2017-11-27-002
    2017-11-27-003


    And records created tomorrow will autopopulate as
    2017-11-28-001
    2017-11-28-002
    2017-11-28-003


    Is this possible without using VBA?

  2. #2
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,176

    Re: Calculated field with resetting increments by time period

    this can be done with zero programming. Set the date field to date/time ,
    with default = now()
    format = General Date

    the records can now be ordered in time order. It does not start at 1 like your example but it is equivalent with zero programming.

    if you want to use vba:

    Now when you need to make a new work order for a new day,
    get the MAX value for THAT date,
    then either start from 1 (if null) or add +1 if this day exists:

    Please Login or Register  to view this content.

    make a query to pull the [RWO] and the bare date values in the RWO. (left 5, no day#)
    in the query: qsDateVals,
    SELECT [RWO],(Left([RWO],5)) AS DateVal FROM tData;

  3. #3
    Forum Contributor
    Join Date
    01-11-2011
    Location
    Frederick, MD, USA
    MS-Off Ver
    Excel 2007
    Posts
    125

    Re: Calculated field with resetting increments by time period

    Quote Originally Posted by ranman256 View Post
    this can be done with zero programming. Set the date field to date/time ,
    with default = now()
    format = General Date

    the records can now be ordered in time order.
    Yes, that would work for a table that already has data in it...but what I'm really trying to do is generate a unique ID that increments, whenever a new record is added. And it does need to start at "001".

    I also should have been more explicit, in that thought the date may be encoded in the field, it won;t be any of the standard date formats, and I'll be adding some text to the field (that is, the final text should look like "GTO-YYMMDD-001", but will be treated as a text field.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 08-15-2016, 02:07 PM
  2. Replies: 0
    Last Post: 10-24-2013, 10:59 AM
  3. [SOLVED] Help taking a time from one field and outputting a time period in a different column
    By Hidden_Gecko in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 02-07-2013, 12:42 AM
  4. Replies: 0
    Last Post: 06-26-2012, 09:06 PM
  5. Replies: 2
    Last Post: 03-06-2009, 11:49 AM
  6. [SOLVED] pivot table formulas for calculated field or calculated item
    By Vicky in forum Excel General
    Replies: 3
    Last Post: 06-06-2006, 12:10 AM
  7. calculated value displayed in increments
    By golden322 in forum Excel General
    Replies: 1
    Last Post: 01-25-2006, 06:35 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1