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

    Update query with the last 6 months data

    I have to update a field data from another table from last 6 months data.



    Table1
    ID
    EmployeeID
    ProjectID


    Table2
    ID
    EmployeeID
    ProjectID
    WeekEnding

    I have to update the table 1 ProjectID with the values of table 2 ProjectID matching with the respective employeeID and weekending should be the last 6 months.

    My Query is:
    UPDATE [Table1], Table2 SET [Table1].ProjectID = [Table2].[ProjectID]
    WHERE (([Table2].[WeekEnding]>#2/15/2018#) AND (([Table1].EmployeeID)=[Table2].[EmployeeID]));

    But I am getting the wrong output.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    it seems to me youd want a date range to 1st pull the dates of the 6 months.
    between forms!myForm!txtStartDate and forms!myForm!txtEndDate
    (Q1)

    then in Q2, take Q1 joined to the data table and to your update.

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

Similar Threads

  1. Replies: 13
    Last Post: 03-13-2017, 05:55 PM
  2. Replies: 3
    Last Post: 05-10-2016, 11:51 AM
  3. Replies: 15
    Last Post: 11-05-2015, 02:07 PM
  4. Replies: 0
    Last Post: 06-19-2014, 05:06 PM
  5. Replies: 3
    Last Post: 02-23-2014, 02:06 PM

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