Results 1 to 2 of 2
  1. #1
    aligahk06 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Apr 2010
    Posts
    94

    Query based on date

    Dear All,

    SELECT workorderPR.prCol1, workorderPR.jobOrderNo, workorderPR.txtCol1, workorderPR.Date, workorderPR.cCode, workorderPR.prCol2, workorderPR.txtCol2, workorderPR.Date2, workorderPR.prCol3, workorderPR.txtCol3, workorderPR.Date3, workorderPR.Remark
    FROM workorderPR
    WHERE (((workorderPR.cCode) Like [Enter the cost code] & "*"));

    The above is my query.in this query when i enter the cost code it display all the cost code records but i want in the same query first i enter the cost code and then ask ask the query enter the from date and to date . so that the query display the record based on date range.


    From date field based on workorderPR.Date ( mandatory field) (yyyy-mm-dd)
    and to date field based on workorderPR.Date ( mandatory field)

    Please assist.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    WHERE workorderPR.cCode Like [Enter the cost code] & "*" AND datefield BETWEEN [enter start YYYY-MM-DD] AND [enter end YYYY-MM-DD];

    However, would be better to use form for input of criteria and reference controls on form or VBA to build criteria string. Review http://allenbrowne.com/ser-62.html
    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.

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

Similar Threads

  1. Replies: 2
    Last Post: 06-28-2017, 06:16 PM
  2. Replies: 4
    Last Post: 04-21-2015, 07:12 PM
  3. Replies: 4
    Last Post: 09-29-2014, 12:24 PM
  4. Date Query: Annual Data Based off of Form Date
    By steveabni in forum Queries
    Replies: 4
    Last Post: 04-21-2014, 02:15 PM
  5. query to update a date based on another date
    By tkendell in forum Access
    Replies: 3
    Last Post: 06-29-2011, 09:32 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