Results 1 to 6 of 6
  1. #1
    Jblackbelt is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2014
    Posts
    20

    Query to update specific field in table

    Hi all,

    I need some help making a query to update a table as balances change. I need to make a query that changes the field CRM Threshold (checkbox) from TRUE to FALSE if the following happens:

    If Tot Cd 2 or 3 has a Curr Princ Bal of less than $1,000,000 CRM Threshold = False

    If Tot Cd 4 has a Curr Princ Bal of less than $2,000,000 CRM Threshold = False

    If Tot Cd 10,11,14,15,16,17,21 has a Curr Princ Bal of less than $2,000,000 CRM Threshold = False

    and then vice versa

    If Tot Cd 2 or 3 has a Curr Princ Bal of greater than $1,000,000 CRM Threshold = True



    If Tot Cd 4 has a Curr Princ Bal of greater than $2,000,000 CRM Threshold = True

    If Tot Cd 10,11,14,15,16,17,21 has a Curr Princ Bal of greater than $2,000,000 CRM Threshold = True

    and that if the Tot Code is not listed above then CRM Threshold = False


    Unfortunately with my limited access knowledge I am not sure where to begin. All help is much appreciated.

    Thanks,

    JB

  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,930
    Saving calculated data is usually a bad idea, especially aggregate data. Calculate when needed. Review http://allenbrowne.com/AppInventory.html
    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
    Jblackbelt is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2014
    Posts
    20
    Unfortunately my hands are tied with the fact that the database was setup previously saving calculated data. The former user of the database set it up that it updates the balances based on a query on a monthly basis. I need to calculate what needs to be reviewed based on balances. The report I created brings those in based on the CRM Threshold checkbox.

    We have a new solution to the database coming in approximately a year, so in the mean time I have to work with what they gave me. Looking at the link (if I understand it correctly) its basing on the # rather than the $ amount, which would be the opposite of what I need. Let me know if I am missing something.

    Thanks again for all your help thus far.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Any query constructed to do the table update could just as well be a SELECT query to calculated the data when needed.

    I am confused on what you need. You say the db is already set up to update the balances - performed monthly? You want to do the update with every data edit? Couldn't you just run the established UPDATE whenever you want?
    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
    Jblackbelt is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2014
    Posts
    20
    Correct. the balance field, Curr Princ Bal, is updated on a monthly basis.

    When they update the Curr Princ Bal field, I want it to update the CRM Threshold Field (a checkbox field that uses true to check the box, false to keep it unchecked) based on the two factors of the records "Tot Cd" and "Curr Princ Bal"

    If Tot Cd 2 or 3 has a Curr Princ Bal of less than $1,000,000 CRM Threshold = False

    If Tot Cd 4 has a Curr Princ Bal of less than $2,000,000 CRM Threshold = False

    If Tot Cd 10,11,14,15,16,17,21 has a Curr Princ Bal of less than $2,000,000 CRM Threshold = False

    and then vice versa

    If Tot Cd 2 or 3 has a Curr Princ Bal of greater than $1,000,000 CRM Threshold = True

    If Tot Cd 4 has a Curr Princ Bal of greater than $2,000,000 CRM Threshold = True

    If Tot Cd 10,11,14,15,16,17,21 has a Curr Princ Bal of greater than $2,000,000 CRM Threshold = True

    and that if the Tot Code is not listed above then CRM Threshold = False

    Let me know if that helps clear up what I am trying to do. I know its a lot of fields.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Yeh, makes my head spin. I think will need custom function to program all those conditional criteria. The function can be called from the UPDATE query.
    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. Replies: 3
    Last Post: 02-13-2013, 10:15 AM
  3. Replies: 1
    Last Post: 08-31-2011, 04:03 PM
  4. update field with specific content
    By luxeon in forum Queries
    Replies: 2
    Last Post: 01-24-2011, 03:29 PM
  5. Replies: 11
    Last Post: 12-04-2010, 10:20 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