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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a Query Parameter with the "like" SQL operator

Status
Not open for further replies.

jdaubens

Technical User
Jul 25, 2000
5
0
0
US
I have the need to select the records in a query based on the last 4 digets in a text field that are equal to a specified value. I created a Query with a parameter as follows:

Parameter Data Type
[Enter Report Year] Text

Then in my Criteria row for the field in the query I specified:

Like "[*Enter Report Year]"

This does not work. Does anyone have any suggestions??

Thanks
 
I believe the format should be Like "*" & [Prompt]

Not sure if that is exact.

Larry De Laruelle
larry1de@yahoo.com

 
It worked! Thanks. Do you have any pointers on how to set up the Criteria to select all of the dates from a field with a date data type that belong to a certain month or certain year?

Thanks again
 
Hi,
In the query design view, set the Field source to Month([MyDateField]) or Year([MyDateField]) , then in the Criteria field assign the appropriate value. For example, if you want all dates in the month of October, put a 10 for the criteria.

Rob Marriott
rob@career-connections.net
 
That worked real well. Thanks for your help.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top