Results 1 to 8 of 8
  1. #1
    Grooz13 is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    97

    Lightbulb query to be able to query many dates

    Ok i have a querry that filter some order we get here at work, and it filters order from yesterday to the next 5 days, always this. But I want to be able sometime to check for the next 10 days is it possible to do without having to change the querry like just do a querry with a changing +days?

  2. #2
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    it will be much easier for us to give an answer if you post you query here.

  3. #3
    Grooz13 is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    97
    Code:
     
    SELECT Tbl_Client.COD, Tbl_Soumission.No_Job, Tbl_Soumission.No_Client, Tbl_Client.Nom, Tbl_Client.Telephone, Tbl_Production.Date_Livraison_Debut
    FROM (Tbl_Client INNER JOIN Tbl_Soumission ON Tbl_Client.No_Client = Tbl_Soumission.No_Client) INNER JOIN Tbl_Production ON Tbl_Soumission.No_Job_auto = Tbl_Production.No_Soumission_Auto
    WHERE (((Tbl_Client.COD)=Yes) AND (((Tbl_Production.Date_Livraison_Debut)<Now() 
    And (Tbl_Production.Date_Livraison_Debut)>Now()-5) 
    Or ((Tbl_Production.Date_Livraison_Debut)>Now() 
    And (Tbl_Production.Date_Livraison_Debut)<Now()+7)));
    sorry those field name are in french but the search field is the -5 +7 and I would want to be able to change the -5 +7 in a form or something

  4. #4
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    if you have 2 textboxes(e.g. day1, day2) in your form ("frmName), you can change the query to:


    SELECT Tbl_Client.COD, Tbl_Soumission.No_Job, Tbl_Soumission.No_Client, Tbl_Client.Nom, Tbl_Client.Telephone, Tbl_Production.Date_Livraison_Debut
    FROM (Tbl_Client INNER JOIN Tbl_Soumission ON Tbl_Client.No_Client = Tbl_Soumission.No_Client) INNER JOIN Tbl_Production ON Tbl_Soumission.No_Job_auto = Tbl_Production.No_Soumission_Auto
    WHERE (((Tbl_Client.COD)=Yes) AND (((Tbl_Production.Date_Livraison_Debut)<Now()
    And (Tbl_Production.Date_Livraison_Debut)>Now()-forms("frmName") .day1)
    Or ((Tbl_Production.Date_Livraison_Debut)>Now()
    And (Tbl_Production.Date_Livraison_Debut)<Now()+forms("frmName") .day2)));

  5. #5
    Grooz13 is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    97
    great idea, and if I want to display the form as a datasheet do I do the same thing ?

  6. #6
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    I think so. just go head, if there is any question, come back here.

  7. #7
    Grooz13 is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    97
    Thank you I adapted what you said to my situation and it works !

  8. #8
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    That's wonderful!

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

Similar Threads

  1. Dates in query criteria
    By thart21 in forum Queries
    Replies: 7
    Last Post: 01-24-2011, 11:56 AM
  2. Query with dates and text
    By theworm in forum Queries
    Replies: 4
    Last Post: 10-27-2010, 05:23 PM
  3. Dates: query and criteria
    By isnpms in forum Queries
    Replies: 5
    Last Post: 08-22-2010, 08:01 AM
  4. Sorting in a Query (Dates)
    By JohnS in forum Queries
    Replies: 2
    Last Post: 10-23-2009, 03:51 AM
  5. Matching Query Dates
    By rgwynne in forum Queries
    Replies: 1
    Last Post: 08-13-2009, 05:23 AM

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