Results 1 to 10 of 10
  1. #1
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Mar 2012
    Posts
    528

    expiration of substance

    Hello all
    A beautiful day for all
    I have a query looking for the expiration of substance


    Used this expression, but to no avail

    Between Date () And DateAdd ("m"; 1; 2; 3; 4; 5; 6; Date ())

    What I want is the account 6 months down

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    DateAdd only has 3 arguments (see: http://www.techonthenet.com/access/f...te/dateadd.php)

    Try:
    Code:
    Between Date() And DateAdd("m";6;Date())
    (assuming your version uses semi-colons as argument separators instead of commas).

  3. #3
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Mar 2012
    Posts
    528
    Thank you JoeM

    But here, if exceeded 6 months does not appear
    Between Date () And DateAdd ("m"; 6; Date ())


    I want to continue to make history at the stage finish

  4. #4
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    I do not understand what you are asking.
    I thought you were looking for any records that expired within the next 6 months (which is why you would use BETWEEN in the first place).

    I do not understand what this means:
    I want to continue to make history at the stage finish

  5. #5
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Mar 2012
    Posts
    528
    Thank you JoeM
    What I said is true
    But
    And medicines actually ended
    For example, 20/01/2014
    Finished into forceClick image for larger version. 

Name:	Capture.PNG 
Views:	9 
Size:	5.7 KB 
ID:	15711

  6. #6
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    I think we may be running into a language barrier (I do not know when "Finished into force" means).

    The two records you highlighted in blue would not be returned, as they expired prior to today's date. If you want to include records that already expired, then you do not want to use BETWEEN, but rather:
    Code:
    <= DateAdd("m";6;Date())
    which would include all records that expire anytime prior to 6 months from today. So that would include all past records, and only the future records that are less than (or equal to) 6 months out.

    If that is not what you are after, perhaps you could walk us through the 6 sample records you posted, and indicate whether or not each one should be returned by your query, and explain the reason why.
    That might go a long way in explaining what it is you are trying to do and why.

  7. #7
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Probably going to have to extract the month, day, and year as text and reconfigure as American date standard before using Date() functions.

  8. #8
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Probably going to have to extract the month, day, and year as text and reconfigure as American date standard before using Date() functions.
    Why would that be?

    If they are using a non-American version, wouldn't that already both extend to their use of functions and date formats?
    I wouldn't think that would be necessary, as long as the data they are running this against is stored as Date/Time data-type (and not text).

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    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.

  10. #10
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Mar 2012
    Posts
    528
    Thank you JoeM , Thank you June

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

Similar Threads

  1. Automatically populate expiration date
    By Tyler in forum Access
    Replies: 2
    Last Post: 01-10-2014, 10:05 AM
  2. Expiration Date
    By nhoover in forum Database Design
    Replies: 5
    Last Post: 03-14-2013, 10:08 PM
  3. Databse Products Expiration Date
    By PATRICK in forum Database Design
    Replies: 9
    Last Post: 02-05-2013, 08:10 PM
  4. Query for upcoming expiration date
    By jones in forum Queries
    Replies: 2
    Last Post: 05-16-2012, 02:18 AM
  5. Expiration Date criteria
    By NISMOJim in forum Queries
    Replies: 9
    Last Post: 07-22-2011, 11:22 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