Results 1 to 2 of 2
  1. #1
    floyd is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    66

    Search by LAST WEEK / LAST MONTH / LAST YEAR

    I have a list box in a form with the following Row Source:
    Code:
    "Between Date() And Date()-6";"This Week";"Between Date() And Date()-30";"This Month";"Between Date() And Date()-90";"This Quarter"
    which is supposed to run a query.



    If I use "Between Date() And Date()-6" in the search in the query it works, but if I try to use it in the list box, I get an error that "The expression is typed incorrectly, or is too complex to be evaluated".

    What am I doing wrong?

    I also tried...
    Code:
    ">=DateAdd("m";-3;Date())";"Past Quarter";">=DateAdd("m";-1;Date())";"Past Month";">=DateAdd("d";-7;Date())";"Past Week"
    Last edited by floyd; 11-01-2013 at 10:17 AM.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    This is doing something I've never seen. Try this in the query as the filter parameter (no idea if it will work):

    Eval([Forms]![yourlistboxname])

    I don't use parameterized queries. I use code to set Filter and FilterOn properties or to set the WHERE CONDITION argument of DoCmd.OpenForm (or Open Report).
    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: 4
    Last Post: 05-26-2013, 03:28 PM
  2. Week Number of Month not Year?
    By kwooten in forum Queries
    Replies: 6
    Last Post: 05-01-2013, 06:59 AM
  3. search records by month and year
    By nurul in forum Forms
    Replies: 8
    Last Post: 12-09-2012, 09:34 PM
  4. First week or business day of the month
    By Dutch1956 in forum Programming
    Replies: 12
    Last Post: 09-18-2011, 08:39 AM
  5. How to display week of the year
    By wongray in forum Access
    Replies: 2
    Last Post: 12-28-2010, 04:46 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