Results 1 to 6 of 6
  1. #1
    MariUSD is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2015
    Location
    Romania
    Posts
    3

    Generate a field in query, with hourly incremented data between MIN MAX interval

    How can I put a field in my query, with all data hourly incremented between 01 January 2015 to 31 December 2015.



    Please forgive my inability.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    A SELECT query can't create records.

    What exactly do you mean by 'all data hourly incremented'? What data do you have? Show examples of raw data and desired output.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    MariUSD is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2015
    Location
    Romania
    Posts
    3
    Quote Originally Posted by June7 View Post
    A SELECT query can't create records.

    What exactly do you mean by 'all data hourly incremented'? What data do you have? Show examples of raw data and desired output.
    Like in Excel. A series begin with 01.01.2015 00:00; 01.01.2015 01:00; 01.01.2015 02:00;... to 31.12.2015 23:00.

    My server receives data via antenna. Sometimes the signal is missing and needs to introduce averages for missing times.
    Thank you for your interest.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Still not enough info.

    What do you mean 'like in Excel'? How does Excel pertain to your Access data?

    That still doesn't show example of your raw data and desired output.

    What does 'introduce averages' mean - do you need to create records?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    MariUSD is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2015
    Location
    Romania
    Posts
    3
    Yes, I need to create records from 01.01.2015 00:00 incremented by 1 hour, to 31.12.2015 23:00. For each record must be populated with registered value or calculated (averaged) value in missing case.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    So create records only for missing time slots? Will require VBA procedure. Something like:

    Code:
    Public Sub Times()
    Dim dateStart As Date, dateEnd As Date
    dateStart = Me.tbxStart
    dateEnd = Me.tbxEnd
    Do While dateStart < dateEnd
       If IsNull(DLookup("ID", "tablename", "datefield=#" & dateStart & "#")) Then
          CurrentDb.Execute "INSERT INTO tablename(datefield) VALUES(#" & dateStart & "#)"
       End If
       dateStart = DateAdd("h", 1, dateStart)
    Loop
    End Sub
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 3
    Last Post: 10-01-2014, 04:09 PM
  2. Replies: 9
    Last Post: 08-11-2014, 01:24 AM
  3. Replies: 3
    Last Post: 11-23-2013, 05:05 PM
  4. Replies: 6
    Last Post: 03-30-2013, 05:42 AM
  5. Replies: 1
    Last Post: 04-25-2012, 11:56 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