Consulting

Results 1 to 4 of 4

Thread: Solved: Wildcard search query

  1. #1
    VBAX Mentor
    Joined
    Oct 2007
    Posts
    357
    Location

    Exclamation Solved: Wildcard search query

    Hi All,

    I have created the below query to search all the record having entered criteria in the phrase in the complete table.

    [VBA]
    SELECT Assigned.Subject, Assigned.ReceivedDateTime, Assigned.ChangedSLADeadLine
    FROM Assigned
    WHERE (((Assigned.Subject) Like "*" & [Enter Criteria] & "*"));

    [/VBA]

    This query is working fine.

    Now I also want that the user should be able to enter the date for which the search should be conducted hence I can narrow down the search to that particular date.

    Below is the query which I created.

    [VBA]
    SELECT Assigned.Subject, Assigned.ReceivedDateTime, Assigned.ChangedSLADeadLine
    FROM Assigned
    WHERE (((Assigned.Subject) Like "*" & [Enter Criteria] & "*") AND ((Int([ReceivedDateTime]))=[Enter Date]));

    [/VBA]

    But now my query is not pulling any data but the data is available for that particular date as per the criteria entered in the first query.

    If I create a query to pull the data for teh date enterd by the user then the queri is working fine.

    But when I create a query by merging two parameters one is first one & the second is date then queri is not working.

    Please guide.

    Regards
    Sudhir

  2. #2
    VBAX Master CreganTur's Avatar
    Joined
    Jan 2008
    Location
    Greensboro, NC
    Posts
    1,676
    Location
    At first blush, I'd say that part of the problem is that you're casting your [ReceivedDateTime] field as an Integer. Also, if [ENterDae] is supposed to be in date/time format, then you need to wrap it with pound signs (#), so that SQL can know the format. Or, if you don't want to enter the data qualifiers, then you'll need to define the parameters- click on Query-> Parameters. Enter in the parameter exactly as you use it in your SQL code, and define the data type.

    HTH
    -Randy Shea
    I'm a programmer, but I'm also pro-grammar!
    If your issue is resolved, please use Thread Tools to mark your thread as Solved!

    PODA (Professional Office Developers Association) | Certifiable | MOS: Access 2003


  3. #3
    VBAX Mentor
    Joined
    Oct 2007
    Posts
    357
    Location
    I am using int([ReceivedDateTime]) because that particulat field has data in the below format:
    "6/29/2009 3:17:31 PM"

    I am trying out your second advise & will let know.

  4. #4
    VBAX Mentor
    Joined
    Oct 2007
    Posts
    357
    Location
    I used your second advise & its nor working fine.

    Thanks randy.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •