Results 1 to 2 of 2
  1. #1
    sahay is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    May 2016
    Posts
    1

    How to update time in Time in access in increasing order in regular time interval?

    I want to update time with difference of 4 min, for particular set of records. for example time


    03-06-2015 11:45:37 AM.
    Now I want to update range of records define by with time difference of 4 min i.e.


    03-06-2015 11:45:37 AM,
    03-06-2015 11:49:37 AM,
    03-06-2015 11:53:37 AM,
    03-06-2015 11:57:37 AM,


    03-06-2015 12:01:37 PM,
    03-06-2015 12:05:37 PM

    i wrote query but it is not working...
    the query is

    UPDATE <TableName> SET <Field Name>= DateAdd("n",[Field Name] * 4, [StartTime])
    WHERE (<Field Name> >= [Start] AND <Field name> <= [END]);



    Please let me the what is issue

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    You can't do it in a query, you'd need VB to loop thru adding the time.

    Code:
    set rst = currentdb.openrecordset("qsMySort")
    M=0
    with rst
      while not .eof
        if m=0 then   VDate = .fields([dateFld]) 
           VDate2 = dateAdd("n",m,vDate)
           .fields([dateFld]) = vDate2
           M=m+4
    Wend
    end with

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 03-06-2016, 03:13 PM
  2. Replies: 7
    Last Post: 07-22-2014, 12:33 AM
  3. Time interval calculation
    By gar in forum Queries
    Replies: 3
    Last Post: 04-09-2013, 02:05 PM
  4. Replies: 6
    Last Post: 03-30-2013, 05:42 AM
  5. Replies: 42
    Last Post: 03-01-2013, 06:58 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums