Results 1 to 4 of 4
  1. #1
    Bh89 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2018
    Posts
    3

    Calculated Fields - Need to update form & Table

    Hi there,

    I have a table; a query and a form.
    I need to work out how long since an order was placed using the following formula Weeks Since Order : DateDiff("ww",[Ref Date],Now())


    Now I have managed to put this formula on my form but I cant sort (from largest to smallest etc) when looking at the form in datasheet view.
    I then put this calculation on the query (select query) but it does not update the table or the form (meaning when a new record is entered, the 'weeks since order' figure is not updated).

    any help would be appreciated. I am loosing patience with this; I am not very good at access so would appreciated simple instructions!

    Thank you,

  2. #2
    Micron is online now Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,424
    Do the sorting in the query if it will be static. If not, provide a means (e.g. option buttons in a frame, command button, etc.) to cycle the sort. This you would handle in code by altering the form rowsource by changing the sort only, then requerying the form. If that sounds like a possibility, you should be able to get help here.

    As for not updating, [Ref Date] is a field in the query? If so, try modifying dates in the query itself. If the calculation changes, you've done that part correctly. Not exactly sure what process you're referring to. You are not trying to save the calculation in a table through a select query, are you? Even if you could, it is very rare that you should be storing calculated values anyway, so I suspect that how to achieve this is kind of a moot point.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    Bh89 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2018
    Posts
    3
    Hi there,

    Thank you for your speedy reply.

    I would like to be able to sort using the filter at the top of the column of my form (in datasheet view) and I would like to store calculated figures in the table as I have to export this data to analyse.
    Yes i am using a select query at the moment; when I try to use an update query the formula DateDiff("ww",[Ref Date],Now()) - i get a syntax error and I am unsure I am using the correct query type.
    In terms of 'cycle the sort', I am a little bit lots as to what you are referring to. Yes Ref Date is a field in the query.

    If you let me know what else you need to know to help me, I will do my best.

    Thanks

  4. #4
    Micron is online now Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,424
    I would like to be able to sort using the filter at the top of the column of my form (in datasheet view)
    Helps, but you didn't answer whether or not the sort will be static, or you want to change it from time to time. If no change, just sort via the query. A simple datasheet view works for me, so I don't see why it would not for you. By cycling the sort, I meant would it be A > Z, possibly changing to Z > A during the same view, and maybe back again as you cycle through records. BTW, you don't say what field you want to sort on, although I suspect it should work even if it's on the calculated field.

    Can you post a zipped copy of your db with brief instructions on how to replicate your issue? It may be that what you need is a 2 step process; create record, then update based on some other/older data. Hard to say without knowing more of what you're trying to do and what you have.

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

Similar Threads

  1. Update events from calculated fields
    By andy49 in forum Forms
    Replies: 4
    Last Post: 02-14-2017, 03:12 PM
  2. Update query with calculated fields?
    By shaunacol in forum Queries
    Replies: 9
    Last Post: 07-09-2015, 01:32 PM
  3. Calculated fields going blank after update
    By Monterey_Manzer in forum Forms
    Replies: 3
    Last Post: 10-08-2012, 03:21 PM
  4. Replies: 1
    Last Post: 03-27-2012, 05:25 PM
  5. Update table from calculated field in a form
    By BernardKane in forum Forms
    Replies: 3
    Last Post: 11-28-2006, 09:48 AM

Tags for this Thread

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