Results 1 to 5 of 5
  1. #1
    janelgirl is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    16

    Smile Wild Cards for Dates?

    I am new to access, so please speak softly, and forgive my ignorance.



    Is there such a thing as a wild card for dates? For example, in a query, using the short date format, if I wanted to look for any record that was ever recorded in any year in October, how would I do that? In other words, my query would return October 1, 1999 and October 14, 2005 and October 23, 2099.

    Here's the rub: I will need to use this over and over again, sometimes I will use it for the actual day, month or year. It will change from query to query depending on the info that I am searching, and I will write expressions as well. I think that wild cards would be the best way to accomplish this, but no matter what I use, I can't seem to get Access to even run the query.

    Any help is appreciated. TIA

  2. #2
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    What have you tried?


    Pattern is

    SELECT * FROM YourTableName WHERE Day(yourDateField) = 1 to 31 ( 30 or 28 rules apply)
    SELECT * FROM YourTableName WHERE Month(yourDateField) = 1 to 12
    SELECT * FROM YourTableName WHERE Year(yourDateField) =

    You could AND criteria
    You could use a BETWEEN

  3. #3
    janelgirl is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    16
    Select * from InvoicesQuery where day(ReceivedDate) = 1 - 31

    This is what i put in from your formula, but it is not working. I tried putting quotation marks around InvoicesQuery, but that did not help. Since I am so new to access, I am sure that there is something simple that I am missing here. Should I replace the asterisk with specific info? Thanks!

  4. #4
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    This would be the SQL for your query to get InvoiceInfo for a specific Day in any Month in any Year

    Select * from InvoicesQuery where day(ReceivedDate) = 21

    You have to put the day, such as 21 for day 21 of any Month in any Year.

    For Month say March (month 3)
    Select * from InvoicesQuery where Month(ReceivedDate) = 3

  5. #5
    janelgirl is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    16
    That worked perfectly!! Thank you VERY much!! :-)

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

Similar Threads

  1. Combine switch function and Wild cards together
    By sandlucky in forum Queries
    Replies: 0
    Last Post: 03-28-2011, 11:51 PM
  2. Magnetic Cards
    By WhiteNite1971 in forum Access
    Replies: 4
    Last Post: 10-24-2010, 01:05 AM
  3. DoCmd.ApplyFilter with wild card
    By cksm4 in forum Programming
    Replies: 3
    Last Post: 10-05-2010, 08:24 AM
  4. Import with a wild card
    By ukgooner in forum Import/Export Data
    Replies: 3
    Last Post: 09-09-2009, 08:08 AM
  5. Printing Flash Cards
    By EricMK in forum Reports
    Replies: 1
    Last Post: 07-08-2009, 12:24 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