Results 1 to 7 of 7
  1. #1
    stryder09 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    85

    Update table from a query

    I have a question on how to update a table from a query.

    I have a database that tracks overtime, if an employee calls in sick, he is unable to work overtime for 2 weeks. I have a freeze table that tracks the employee, the date they are frozen, to the date they are available to work again.

    I would like a query that when ran, will look at the Available to work Again field and if the date they can work again matches todays date, it then edit the employee table turning the freeze field from Frozen (Yes), to Unfrozen (No).

    I am using two table

    tblemployee and



    tblFrozenOvertime

    the tblemployee has the overtime Frozen field

    and the tblFrozenOvertime table had the Available to work again field which is also on a frmFrozenOvertime.

    any help would be appreciated.

    Thanks,

    Brad

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    Can this Frozen/UnFrozen state be calculated from other data - perhaps the DateFrozen and DateAvailable fields (BTW, DateAvailable can probably also be a calculated field)? If so, there is no need to have this field in table and issue of updating is non-existent.
    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
    stryder09 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    85
    The DateAvailable is a calculated field it is [DateFrozen] + 14

    but what I need it to do is for the supervisors to run a query by a button push that will look at the DateAvailable, and if it is the same as todays date or earlier, it will turn the Freeze off, and that employee is now back on the overtime list.

  4. #4
    stryder09 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    85
    Sorry meant to add that the froane field is just a yes/no field. So it just changes from yes to no, depending on the date.

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    My comments still apply. Calculate this value when needed on form and report.

    Any query that could accomplish the UPDATE could just as easily be a SELECT query to display the status.
    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.

  6. #6
    stryder09 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    85
    So I'm not sure how I would build that in my query?

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    Don't know your data structure so can't be specific.

    Basically, if AvailableDate is less than current date then individual is available (Unfrozen) so this is an IIf() conditional expression in query or in textbox.

    Could involve nested subquery or domain aggregate functions (DLookup, DMax, etc).
    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: 1
    Last Post: 05-17-2013, 12:53 PM
  2. Update query won't update table
    By bonesie in forum Access
    Replies: 6
    Last Post: 01-15-2013, 05:22 PM
  3. Replies: 6
    Last Post: 05-10-2012, 08:20 PM
  4. Replies: 1
    Last Post: 02-08-2012, 04:50 PM
  5. Replies: 2
    Last Post: 12-20-2011, 07:33 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