-
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
-
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
-
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.
-
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
-
Forum Rules