Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 33
  1. #16
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    UT227,

    Can you tell us what the first 5 lines in your post #14 mean in your set up?
    You have expiryDates in the past, current year and future.



    I'm not sure readers (me) is understanding your issue.

  2. #17
    UT227 is offline Expert
    Windows 7 32bit Access 2013 32bit
    Join Date
    Feb 2016
    Posts
    581
    I have classes (certifications) that expire. They expire at different dates. In order to prepare for people expiring, I need to know when they expire. I want to look ahead X many months and see which classes (certifications) are about to expire. Example: I'm looking ahead 4 months to see which classes are going to need to be scheduled.

  3. #18
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    I suggest you work with Days ---not Months for consistency.

    You have
    -a Person who may have 1:M Certifications
    -a Certification has a specific StartDate and ExpiryDate


    Person -->PersonHasCertification<--Certification

    ** seems you want to know which Person(s) have Certification(s) that will Expire at some future ExpiryDate

    ** are you trying to determine when specific classes/certifications need to be scheduled?
    ** does having a class depend on the number of Person(s) involved?

    ??Do you have some mechanism to identify Person(s) whose Certification(s) has/have expired??
    ??Do you care about expired certification??

    Can you tell us how you interpret the first 5 rows as mentioned in my previous post?

    Good luck.

  4. #19
    UT227 is offline Expert
    Windows 7 32bit Access 2013 32bit
    Join Date
    Feb 2016
    Posts
    581
    Those are classes that expire. The [MonthsLeft] is how many months are left until that person needs to take the class again. I took the difference between today's date and the date of the last class. I then took the difference between the expiration date and that date. That gave me how many more months there were left until it expires.

  5. #20
    UT227 is offline Expert
    Windows 7 32bit Access 2013 32bit
    Join Date
    Feb 2016
    Posts
    581
    I'd rather go by months for a search. I only need a general overview of everyone that will be expiring in whichever classes are about to expire. I'm not concerned with those already expired as they should be lumped together with those about to expire. That's why I want a search that is less than or equal to the number I'm looking for. If they are already expired, the number should be negative for them and that will be less than what I'm looking for. So, it should appear in my query. I do not need to look for a specific class. I already have a search for specific classes and persons. Classes are not dependent on the number of people in the class.

  6. #21
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    So the -20 and -31 have relevance to you.
    What does a negative [MonthsLeft] mean? They are all expired, right?

  7. #22
    UT227 is offline Expert
    Windows 7 32bit Access 2013 32bit
    Join Date
    Feb 2016
    Posts
    581
    Yes, negatives are all expired

  8. #23
    Micron is online now Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,425
    Still no idea where the [DaysPassed] and [DaysToExpir] are coming from. Maybe it's not relevant...
    I took the difference between today's date and the date of the last class. I then took the difference between the expiration date and that date. That gave me how many more months there were left until it expires.
    Wouldn't you get the same thing by subtracting Date from expiry date (in one calculation)? Future expiry would be positive, past expiry negative.

  9. #24
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870

  10. #25
    UT227 is offline Expert
    Windows 7 32bit Access 2013 32bit
    Join Date
    Feb 2016
    Posts
    581
    Absolutely. I appreciate the insight. That worked very well. I got the same results, but there were less calculations. I sill have the same problem though. When I search in the query <=2, it gives me the correct results. When I use <=[Forms]![frmTrainingSearch]![txtMonths], it gives me incorrect results. Any ideas?

  11. #26
    Micron is online now Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,425
    I just noticed something. In post 11 pics, you got a parameter prompt from the query and had to enter 2 yourself. This probably means your control reference is bad. Either the form or control name is mis-spelled or it resides on a subform. Can't recall if you'd get the prompt if the form wasn't open in form view (thinking the query would just run) so I'll not suggest that. Besides, I brought this up in an earlier post of mine, so I'm going with bad reference. If that's not it, I suggest you post a zipped copy of your db. If there is sensitive data in it, remove all as necessary but leave in something that will allow the required queries and forms to work.

    EDIT: or the form resides on a navigation form.

  12. #27
    UT227 is offline Expert
    Windows 7 32bit Access 2013 32bit
    Join Date
    Feb 2016
    Posts
    581
    It's getting the text box off the form just fine. I just figured out that It's the < that is causing the problem. When I use = it works just perfectly. When I just use the < or > it gives the wrong return.

  13. #28
    UT227 is offline Expert
    Windows 7 32bit Access 2013 32bit
    Join Date
    Feb 2016
    Posts
    581
    This is kinda interesting. When I use 1 or 10 or more, I get back a good return. 2-9 gives back a bad return, it shows all records.

  14. #29
    Minty is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,158
    Okay that is strange - can you post up a sample set of data and the query and just the form you are using.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  15. #30
    UT227 is offline Expert
    Windows 7 32bit Access 2013 32bit
    Join Date
    Feb 2016
    Posts
    581
    I took out as much as I could. I attached a small database. It seems to be doing the same thing.
    Attached Files Attached Files

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

Similar Threads

  1. Replies: 2
    Last Post: 09-19-2017, 11:31 AM
  2. Replies: 5
    Last Post: 07-12-2014, 02:55 PM
  3. Replies: 5
    Last Post: 01-29-2014, 02:42 PM
  4. Replies: 1
    Last Post: 10-18-2013, 03:14 PM
  5. Query input dates for range of dates in two fields
    By kagoodwin13 in forum Queries
    Replies: 3
    Last Post: 02-13-2012, 04:25 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