Wildcard in searches beginning and ending terms

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • neobrainless
    New Member
    • Mar 2013
    • 31

    Wildcard in searches beginning and ending terms

    Ok, so I have got my search form working now (thanks to various people for helping with previous issues!), and I have wildcards for all but the date entries (not sure if it's possible for that?). However, the wildcards are only for the END of an entry, so for example 'ab*' will find 'abc123' (and 'abd234', etc) but I was wonderign if it's possible to do the same with the sart, so '*c123' would find 'abc123' and acc123' etc?

    Cheers :)
  • zmbd
    Recognized Expert Moderator Expert
    • Mar 2012
    • 5501

    #2
    Access wildcard character reference (v2003)
    Will answer most of your questions.

    The date becomes tricky...
    Say I have a table with shipping dates, and I want to return every instance where there was a shipment on the 10th day of the month for evey record then the sql would be:
    Code:
    SELECT tbl_shipdate.ShippedDate
    FROM tbl_shipdate
    WHERE (((tbl_shipdate.ShippedDate) Like "*/10/*"));
    However say I want between dates

    Code:
    SELECT tbl_shipdate.ShippedDate
    FROM tbl_shipdate
    WHERE (((tbl_shipdate.ShippedDate) 
       Between #1/1/2010# 
          And #1/15/2010#));
    What about every date past a given date:

    Code:
    SELECT tbl_shipdate.ShippedDate
    FROM tbl_shipdate
    WHERE (((tbl_shipdate.ShippedDate)>=#1/1/2010#));
    To make my life easier from a coding standpoint, I try to keep to the "#" type constructs and bracket the time frame using either the between or ">=" or "=<" types. However, that doesn't always work.

    If you have a specfic filter issue post back and we can straighten that out.

    Comment

    • Seth Schrock
      Recognized Expert Specialist
      • Dec 2010
      • 2965

      #3
      I didn't know that wildcards could be used in dates like your first example. I normally use
      Code:
      WHERE Day(tbl_shipdate.ShippedDate) = 10
      Is there a benefit of one over the other?

      Comment

      Working...