Results 1 to 8 of 8
  1. #1
    JonathanT is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2011
    Posts
    118

    Filter Calculated field in a parameter query


    I have a form and I want to limit the number of fields a users needs to complete to add a record. I created 3 calculated date fields in Table1 that fill in the month, year and quarter that correspond to the date in the [CurrDate] field. I would like to be be able to filter by any one of the the 3 calculated fields in a parameter query (TableQry1) but I get no results when I try the normal way to filter a query. Not even sure if this can be done but I thought I would ask. DB attached
    Attached Files Attached Files

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Format property does not change actual value. Value of these calculated fields is either Null or full date from original CurrDate field, regardless of what Format property displays. I never set Format property in table.

    If you want to filter on date portion, then need to extract from original date.

    Year(CurrDate)

    Month(CurrDate)

    Format(CurrDate, "mmmm")

    DatePart("q", CurrDate())
    Assumes quarter numbering starts with January. If you want quarter numbering to start with another period, say fiscal year beginning July, that will call for a different approach.

    Unfortunately, Format and DatePart functions are not available to table Calculated field. Do calcs in query or textboxes instead of table.

    If field is Null, result will be Null.
    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
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    there is no attachment. See "how to attach files" at the top of the page.
    Usually, calculated fields in tables should be avoided. Calculations are best done on the fly. It should be possible to get any month, day or year value out of any date field using those intrinsic functions. Getting the quarter is a common question but I have to be honest; not sure how as I've never needed it.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Micron, I see an attachment and downloaded file.
    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
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Not me. Firefox version 119.0
    It's there in M$ Edge though.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Now I know why. It would appear that if someone is on your IL you can elect to view their posts, but attachments won't show. It showed in Edge because I wasn't logged in to the forum.
    Last edited by Micron; 11-09-2023 at 07:26 PM. Reason: added info
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  7. #7
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,044
    Quote Originally Posted by Micron View Post
    calculated fields in tables should be avoided. Calculations are best done on the fly.
    I don't know that, depends if the fields are persistent or not. On SQL server we use persistent calculated fields because they are saved to disk and can be indexed, so it's much faster than do the calculation over and over again when running the query. So if Access works with persistent calculated fields, it's certainly better to do them in the table. Another advantage is that you have the calculated fields ready for every query you need to make, simplifying the query. This could solve the error 'query to complex to perform' you sometimes get.

  8. #8
    JonathanT is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2011
    Posts
    118
    Thanks for all the replies. Looks like I have to nix the calculated fields in the table. I can do what I want in the data entry form itself.

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

Similar Threads

  1. Replies: 6
    Last Post: 05-26-2017, 04:10 PM
  2. Replies: 5
    Last Post: 05-13-2016, 11:00 AM
  3. Replies: 2
    Last Post: 12-30-2014, 01:32 PM
  4. Replies: 3
    Last Post: 12-28-2013, 09:13 AM
  5. Parameter Query on a calculated field
    By l3111 in forum Queries
    Replies: 5
    Last Post: 10-12-2011, 02:18 PM

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