Results 1 to 2 of 2
  1. #1
    Shamli is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jul 2018
    Location
    California
    Posts
    142

    Append table with the previous week data and the current data

    How to append a table with User's input from the previous week data and the current data.



    Main table has the data from the starting week to the current week .
    But I have to create a table that hold only the previous week data and the current week data form the main table.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    on a form, have the dates for the current data:
    txtStartDate, txtEndDate

    and the prev data (these can be hidden if you want):
    txtPrevStart, txtPrevEnd

    when the current is entered, the afterupdate event can fill in the previous datas

    Code:
    sub txtStartDate_Afterupdate()
      txtPrevStart = DateAdd("d",-6,txtStartDate)
    end sub
    
    sub txtEndDate_Afterupdate()
      txtPrevEnd = DateAdd("d",-6,txtEndDate)
    end sub
    then the query can use these

    query qsCurrent:
    select * from table where [date] between forms!myForm!txtStartDate and forms!myForm!txtEndDate

    query qsPrev:
    select * from table where [date] between forms!myForm!txtPrevStart and forms!myForm!txtPrevEnd

    then you can put both queries together in a union query.

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

Similar Threads

  1. Copy current data and Append
    By Zafarm in forum Access
    Replies: 1
    Last Post: 07-10-2017, 07:48 PM
  2. Replies: 2
    Last Post: 12-01-2014, 02:53 AM
  3. Replies: 3
    Last Post: 09-19-2013, 10:18 AM
  4. Displaying Previous Week's Data in Subreport
    By mejia.j88 in forum Reports
    Replies: 3
    Last Post: 06-30-2012, 01:07 PM
  5. DSum where data is from previous week only
    By doodles in forum Access
    Replies: 3
    Last Post: 01-31-2011, 08:35 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