Results 1 to 2 of 2
  1. #1
    MatthewR is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2015
    Posts
    118

    Age Parameters Not Working Correctly

    Hi, all. I have a field in a query that calculates a person's age at the time of an incident. Here's the formula I use:



    Age: DateDiff("yyyy",[DateofBirth],[Incident Date])-IIf(Format([DateofBirth],"mmdd")>Format([Incident Date],"mmdd"),1,0)

    The formula works just fine. But I want to have parameters to set a minimum and maximum age. So, I added the following criteria:

    Between [MinAge] And [MaxAge]

    But it doesn't really work. There are a total of 32 people in the query without parameters.

    With the parameters, when I enter zero as the minimum, and 100 as the maximum, I get no records.

    When I enter 200 as the maximum, I get 3 records.

    When I enter 1000 as the maximum, I got no records.

    And when I enter 999999, I get all 32 records.

    WTF.

    Haaaalp!

    Thank you kindly.

    Matt

  2. #2
    MatthewR is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2015
    Posts
    118
    Am I the only person who always spends an hour hopelessly trying to solve a problem, then posts on this forum in exasperation, only to solve the problem all of 1 minute later?

    Okay, so I discovered that I need to go to the Query Design Ribbon, select parameters, and set a data type of Integer for the parameters. That does the trick! Oh, Happy Day!

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

Similar Threads

  1. WHERE not working correctly?
    By aellistechsupport in forum SQL Server
    Replies: 5
    Last Post: 01-02-2016, 04:24 AM
  2. Replies: 9
    Last Post: 09-03-2015, 10:04 AM
  3. Replies: 2
    Last Post: 09-03-2013, 05:12 PM
  4. Unable to get Switch working correctly
    By Seeletse in forum Forms
    Replies: 13
    Last Post: 12-12-2012, 04:08 AM
  5. Condtion not working correctly
    By hawkins in forum Access
    Replies: 3
    Last Post: 09-07-2011, 02:59 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