Results 1 to 3 of 3
  1. #1
    Join Date
    May 2008
    Posts
    2

    Combining like update queries

    I am looking to take 4 existing update queries and transform them into one. Here are the queries.

    UPDATE [Employee Information] SET [Employee Information].SickDaysAvailable = 0, [Employee Information].VacationDaysAvailable = 5, [Employee Information].BerevementDaysAvalable = 2, [Employee Information].PersonalDaysAvailable = 1, [Employee Information].[Excused U/P Days Off] = 0, [Employee Information].[Unexcused U/P Days Off] = 0, [Employee Information].Tardies = 0
    WHERE ((([Employee Information].AnniversaryDate)>=Date()-1825 And ([Employee Information].AnniversaryDate)<=Date()-365));



    UPDATE [Employee Information] SET [Employee Information].SickDaysAvailable = 0, [Employee Information].VacationDaysAvailable = 10, [Employee Information].BerevementDaysAvalable = 2, [Employee Information].PersonalDaysAvailable = 3, [Employee Information].[Excused U/P Days Off] = 0, [Employee Information].[Unexcused U/P Days Off] = 0, [Employee Information].Tardies = 0
    WHERE ((([Employee Information].AnniversaryDate)>=Date()-3650 And ([Employee Information].AnniversaryDate)<=Date()-1825));



    UPDATE [Employee Information] SET [Employee Information].SickDaysAvailable = 0, [Employee Information].VacationDaysAvailable = 15, [Employee Information].BerevementDaysAvalable = 2, [Employee Information].PersonalDaysAvailable = 3, [Employee Information].[Excused U/P Days Off] = 0, [Employee Information].[Unexcused U/P Days Off] = 0, [Employee Information].Tardies = 0
    WHERE ((([Employee Information].AnniversaryDate)>=Date()-7300 And ([Employee Information].AnniversaryDate)<=Date()-3651));



    UPDATE [Employee Information] SET [Employee Information].SickDaysAvailable = 0, [Employee Information].VacationDaysAvailable = 20, [Employee Information].BerevementDaysAvalable = 2, [Employee Information].PersonalDaysAvailable = 3, [Employee Information].[Excused U/P Days Off] = 0, [Employee Information].[Unexcused U/P Days Off] = 0, [Employee Information].Tardies = 0
    WHERE ((([Employee Information].AnniversaryDate)<=Date()-7300));



    I am hoping that someone can help me out.

  2. #2
    Join Date
    May 2008
    Location
    North Charleston, SC
    Posts
    20
    access syntax is trickier than SQL, but i think this will help get you there:

    Code:
    UPDATE [Employee Information] 
    SET [Employee Information].VacationDaysAvailable =
    iif ((([Employee Information].AnniversaryDate)>=Date()-1825 And ([Employee Information].AnniversaryDate)<=Date()-365)), 5, 
        iif ((([Employee Information].AnniversaryDate)>=Date()-3650 And ([Employee Information].AnniversaryDate)<=Date()-1825)), 10,
            iif ((([Employee Information].AnniversaryDate)>=Date()-7300 And ([Employee Information].AnniversaryDate)<=Date()-3651)), 15,
                iif ((([Employee Information].AnniversaryDate)<=Date()-7300)), 20,0))))

  3. #3
    Join Date
    May 2008
    Posts
    2
    Thanks! I will try that

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

Similar Threads

  1. Combining Two Queries
    By csolomon in forum Queries
    Replies: 1
    Last Post: 09-03-2009, 01:33 PM
  2. Help me please w/ combining like customers
    By lsulaurie in forum Queries
    Replies: 2
    Last Post: 06-30-2008, 02:59 PM
  3. Replies: 1
    Last Post: 06-21-2007, 01:02 PM
  4. Combining Databases
    By RHall in forum Access
    Replies: 2
    Last Post: 04-13-2006, 07:36 AM
  5. Help combining 3 tables
    By luscioussarita in forum Queries
    Replies: 1
    Last Post: 12-14-2005, 03:22 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