Page 2 of 2 FirstFirst 12
Results 16 to 22 of 22
  1. #16
    hehrerh is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    35


    Quote Originally Posted by davegri View Post
    Attachment 32904

    You have 10 calculated fields in table YearSetup, which is the table being updated by your requested code. I couldn't analyze the effect of that on changes made to the table data via the code, but here's what I have...
    I eliminated all the table fields in the query that weren't involved in the update logic. It was just confusing extra stuff to wade through that had no reason to be there at all.
    One hitch.... is there a way to run all calculations on the to-be-copied record BEFORE copying the 2 fields?

    1. run calculations on the current record
    2. copy the 2 values
    3. move to the next record and paste the 2 values
    4. repeat

    I'm finding that some calculations are not firing between the copy/paste.

    Thank you!

  2. #17
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,706
    Calculated fields in tables are NOT good practice and should be avoided. You have found one reason why.
    You can save yourself a lot of trouble by removing those fields entirely from the table and putting them in a query that does the calculations. Then base any forms, reports, etc on that query.

  3. #18
    hehrerh is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    35
    Quote Originally Posted by davegri View Post
    Calculated fields in tables are NOT good practice and should be avoided. You have found one reason why.
    You can save yourself a lot of trouble by removing those fields entirely from the table and putting them in a query that does the calculations. Then base any forms, reports, etc on that query.
    That's no problem and I will do that, but I believe I will have the same issue.

    If the code is then applied to the query, the same calculation order problems would persist.

  4. #19
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,706
    Use a different query for the code. That would update the table.
    Then use the query that does the calculations.
    If that still presents a timing problem, then perhaps your design is off.

  5. #20
    hehrerh is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    35
    Can you please take a look at what I have? I created a query for the table. I moved all calculations into the query qryYearSetup.

    I don't quite understand what you mean by using a 2nd query for the code.. should the query the code is run on be based on the table YearSetup (no calcs), or on the query qryYearSetup (with calcs)?

    Attached the database. Excuse the additional messy queries and forms.
    Attached Files Attached Files

  6. #21
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,706
    Database161-davegri-V01.zip
    Had to add sort to [YearSetup Query] so that each next record was in correct order for logic to work.

  7. #22
    hehrerh is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    35
    Just wanted to follow up and let you know that this did the trick.

    Also - thank you for the tip that calculations should take place within queries. This has helped me better organize all of my work.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 12-02-2017, 02:04 PM
  2. Replies: 4
    Last Post: 09-21-2014, 04:08 PM
  3. Replies: 7
    Last Post: 11-18-2013, 02:38 PM
  4. Replies: 10
    Last Post: 03-05-2013, 03:10 PM
  5. Replies: 5
    Last Post: 08-01-2012, 11:39 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