Results 1 to 6 of 6
  1. #1
    phineas629 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2011
    Posts
    47

    Calculation into a column

    Hi all,

    I'm updating fall pay dates which is half of the award total. I'm also entering a date. This is all going into the same table.


    However, I'm getting '0' in the table for everything when performing the following query. The data types are right also.

    Any ideas?



    Code:
      
    
    strSql = " UPDATE Award SET Award.Amount_FallPay = Award.AWARD_Total/2," & _
                    " Award.AWRD_AMOUNT_FallPayDate = #" & Me.txtFallPaymentDate & " #" & _
                    " WHERE Award.AWARD_Ready = True and AWARD_Season ='Fall'"
            CurrentDb.Execute strSql

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,615
    Saving calculated data is often bad idea. Is the FallPay always half AWARD_Total? Why saving such simple calculated value? Award_Total is total of what - several fields of same record?

    Provide example data for the Award table.
    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
    phineas629 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2011
    Posts
    47
    The total is always split in half. I want to show it on a user form. That amount will also be going into a linked table in another database where it is normalized.


    client award_total fallpay springpay
    johnny 1000 500 500
    sue 500 250 250


    Quote Originally Posted by June7 View Post
    Saving calculated data is often bad idea. Is the FallPay always half AWARD_Total? Why saving such simple calculated value? Award_Total is total of what - several fields of same record?

    Provide example data for the Award table.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,615
    How is the Award_Total field populated? Is it by data entry?

    I really can't see reason for the UPDATE to fail.

    Next step is to provide db for analysis. Follow instructions at bottom of my post.
    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
    phineas629 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2011
    Posts
    47
    Thank you for checking my syntax. I needed so bad for someone to confirm. I compacted and then redid my odbc connection and now it works. I had a sql backend, the database and then the front-end interface. not sure where it went wrong. The code went through but displayed all zeros. any ideas what could've caused this?

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,615
    No idea. Never used SQL backend.
    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: 11-12-2013, 02:19 AM
  2. Calculation Field in table vs Query calculation
    By Leonidsg in forum Database Design
    Replies: 18
    Last Post: 02-28-2013, 09:38 PM
  3. Replies: 1
    Last Post: 12-08-2011, 08:03 AM
  4. Replies: 1
    Last Post: 04-15-2010, 02:07 AM
  5. Replies: 2
    Last Post: 03-03-2010, 07:37 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