Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Over 65 Criteria
Larry Fisackerly 
      
2 years ago
I watched your tech help about using DateDiff and DateSerial to calculate correct age in years. Works perfectly. How do I add a criteria to show me everyone 65 or older? I got a data mismatch error when I put >=65 in the criteria field below calculated field. Thanks in advance!
Richard Rost  @Reply  
          
2 years ago
You can't put that criteria in the same query as the calculation. You'll have to take the results of that query and feed it into a second query, and you could put the criteria there.
Richard Rost  @Reply  
          
2 years ago
I actually have a video on this topic coming out pretty soon because it's a common mistake.
Larry Fisackerly OP  @Reply  
      
2 years ago

Larry Fisackerly OP  @Reply  
      
2 years ago
I am still doing something wrong. Created second query based on query calculating exact age. Couldn't figure out the proper way to add criteria to avoid data type mismatch error
Larry Fisackerly OP  @Reply  
      
2 years ago

Kevin Robertson  @Reply  
          
2 years ago
Your criteria was correct in the first screenshot. Do it like that in the second Query.
Richard Rost  @Reply  
          
2 years ago
Could be due to Null values in the table. See Another Query Fails.
Larry Fisackerly OP  @Reply  
      
2 years ago
There are no null values. I created a 2nd query based on 1st query. 2nd query properly returns 0's and -1's. How do I writer criteria in 2nd query to display on records with 0's? I need to do same thing with records returning -1's. I want a list of records for under 65 and one for over 65.
Richard Rost  @Reply  
          
2 years ago
Just set your criteria to whatever you want to see.
Larry Fisackerly OP  @Reply  
      
2 years ago
I created a query using your exact age function. Works perfectly I then created a second query based on the first query to identify records where age was greater than or equal to 65 or less than 65. Works perfectly it returns zeros and minus ones. For I then create a query based on the second query to select only records with zeros, I get a data type mismatch error. I don't know how to fix that. What is the data type being returned that yields zeros and minus one. Please show me how to ride a criterion that will select only the zeros and another one that will select only the minus ones. I spent three days going in circles and beating my head against the wall. I've done my due diligence. I'm waving a white flag. Please help me figure out this very simple problem.
Larry Fisackerly OP  @Reply  
      
2 years ago

Kevin Robertson  @Reply  
          
2 years ago
What is being returned are Boolean values (True/False).
Larry Fisackerly OP  @Reply  
      
2 years ago
How do I use the Boolean value False in a criteria to show only those records match False? That is what I don't know.
Sami Shamma  @Reply  
             
2 years ago
test for either "True" or "False" as needed.
Larry Fisackerly OP  @Reply  
      
2 years ago
I have tried the following in the Criteria row: -1, 0, True, False. I have tried with and without quotation marks. There is something very basic I am overlooking. Everything I have tried has generated the error data type mismatch. Please help.
Larry Fisackerly OP  @Reply  
      
2 years ago

Kevin Robertson  @Reply  
          
2 years ago
Show us what the data look like.
Richard Rost  @Reply  
          
2 years ago
Could be the problem I referenced in the video above... You may need to dump the data into a temp table.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/7/2026 6:31:32 AM. PLT: 1s