Results 1 to 5 of 5
  1. #1
    scoughlan is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2012
    Location
    London
    Posts
    13

    This Week field criteria


    Apologies for my ignorance in advance! I simply wish to replicate the This Week Date Filter as a date type Field Criteria in a query. Is this possible? The MS Examples of query criteria has this expression: DatePart("ww", [SalesDate]) = DatePart("ww", Date()) and Year( [SalesDate]) = Year(Date()). But, this requests a date input. I simply want it to run with the current date without asking for user input. Thanks for any help you can give me.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,643
    The Date() function should grab the current date from system, not prompt for input. Is the field SalesDate actual name of field in the query? What is the displayed text of popup prompt?
    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.

  3. #3
    scoughlan is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2012
    Location
    London
    Posts
    13
    Thanks for helping. Yes, the pop-up prompt is labelled Sales Date. MS describes the criteria such:

    Contain dates that fall during the current week. Returns records of transactions that took place during the current week. A week starts on Sunday and ends on Saturday.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,643
    That means Access is not finding a field by that name and assumes you want user to input a value. The resulting expression is nonsense. What is the name of the field you want to filter on? Use that in place of SalesDate, or is it Sales Date with a space - you show both forms in your posts.
    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.

  5. #5
    scoughlan is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2012
    Location
    London
    Posts
    13
    Thank you so much. You were quite right: As soon as I changed SalesDate for my own field it worked perfectly. Problem solved!

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

Similar Threads

  1. Setting Criteria with a Lookup Field
    By winteram in forum Queries
    Replies: 1
    Last Post: 08-16-2011, 09:44 AM
  2. Different criteria for same field in same query
    By teirrah1995 in forum Queries
    Replies: 10
    Last Post: 08-12-2011, 01:03 PM
  3. Basing criteria on another Field
    By starhannes in forum Queries
    Replies: 3
    Last Post: 04-21-2010, 04:02 PM
  4. Replies: 4
    Last Post: 01-19-2010, 05:36 AM
  5. Run Report with Prompt for Field Criteria
    By diane802 in forum Reports
    Replies: 4
    Last Post: 01-15-2010, 02:31 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