Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LIKE Operator and custom dialog box

Status
Not open for further replies.

MelF

Technical User
Oct 26, 2000
81
US
Question of the day:

I have a custom dialog box (form) that prompts for criteria, then opens my report based on the specified criteria (Begin date, end date, and ProductName) It is working fine, and the query behind my report is:

SELECT DISTINCTROW ProductsUsedbyDateQuery.ProductName, Sum(ProductsUsedbyDateQuery.Quantity) AS SumQuantity
FROM ProductsUsedbyDateQuery
WHERE (((ProductsUsedbyDateQuery.OrderDate)>=[forms]![DateRangeForm]![BeginDate] And (ProductsUsedbyDateQuery.OrderDate)<=[forms]![DateRangeForm]![EndDate]))
GROUP BY ProductsUsedbyDateQuery.ProductName
HAVING (((ProductsUsedbyDateQuery.ProductName)=[Forms]![DateRangeForm]![ProductName]));


However, I want the user to be able to enter a partial name. I've tried adding the Like clause many different times, and keep getting the syntax error. I got this to work fine in a query using the WHERE clause instead of the HAVING. ??????

 
Hi Mel, (me again...)
In the criteria for your query something &quot;like&quot; this:

Like [Forms]![DateRangeForm]![ProductName] & &quot;*&quot;

Might fly!
Gord
ghubbell@total.net
 
GORD - Thanks again!!! I was trying to do this in SQL view and not having much luck, but tried it in regular design view - And it works!!

Thanks!!!!

-Melody
 
Anytime Mel!
SQL should be:

Like '&quot; & [Forms]![DateRangeForm]![ProductName] & &quot;'*&quot;

or so.... :) Gord
ghubbell@total.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top