Results 1 to 2 of 2
  1. #1
    rjackson is offline Novice
    Windows 10 Access 2007
    Join Date
    Aug 2016
    Posts
    2

    Use next record DateTime (StartTime) field data to populate the DateTime (EndTime) field

    I have tried using the DLOOKUP -
    Code:
    EndTime: DLookUp([LineInfo]![DateAndTime],"LineInfo",[LineInfo]![ID_Event]=" &   [LineInfo]![ID_Event]  + 1")
    I have tried DLOOKUP on the same record and it works for integers, but I can't get a DateTime field to copy correctly.
    The data structure is as follows: ID_Event - primary key AutoNumber, DateAndTime - Date/Time, Batch - Text, Event_ID - integer, EncodedEvent - integer,(Calculated field) EndTime.
    After I tackle this I will need to use DateDiff() to calculate a duration field in seconds. Sure could use the help.
    The final version uses an inner join on EncodedEvent to display the actual event (Decoded). This will output to a report and pie chart.
    Attached Thumbnails Attached Thumbnails EndTime.JPG  

  2. #2
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,800
    You need to wrap non numeric data types in their proper delimiters: " for text and # for dates.
    Take a look here for some examples of using DLookup. Note that if using form controls in the function, you need to properly concatenate the control name and any required delimiters. The site shows delimited and control reference examples, but not a mixture of both, I believe.
    BTW, your syntax is a bit more verbose than it needs to be. The examples
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Setting a DateTime field back to "empty"
    By ts_hunter in forum Forms
    Replies: 12
    Last Post: 08-14-2015, 10:46 AM
  2. Replies: 2
    Last Post: 07-20-2015, 07:51 PM
  3. Conditional Formatting on datetime field
    By Delta729 in forum Access
    Replies: 3
    Last Post: 05-06-2015, 03:37 PM
  4. Help with datetime field in subform
    By Delta729 in forum Access
    Replies: 3
    Last Post: 04-07-2015, 04:47 PM
  5. Update datetime stamp on record modification
    By sitaramnayak in forum Access
    Replies: 1
    Last Post: 10-12-2011, 11:54 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