PDA

View Full Version : Solved: Wildcard search query



kbsudhir
06-30-2009, 06:47 AM
Hi All,

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


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


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.


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


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

CreganTur
06-30-2009, 06:59 AM
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:thumb

kbsudhir
06-30-2009, 07:14 AM
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.

kbsudhir
06-30-2009, 07:36 AM
I used your second advise & its nor working fine.

Thanks randy.