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

Criteria question

Status
Not open for further replies.

ptrifile

Technical User
Aug 10, 2004
457
US
I have a very basic query that queries based on a "team name". In the criteria of the query i have [Enter Team Name]. I just want to know if there is any wild card that i can use when the "enter team name" pops up to show ALL records in the table?

Thanks!

Paul
 

If your query is something like:
Code:
Select * from SomeTable
Where TeamName [blue]= [Enter Team Name][/blue]
Then user has to enter exactly the team name in order to get anything,

But if you have something like:
Code:
Select * from SomeTable
Where TeamName [blue]LIKE[/blue] '* & [Enter Team Name] & *'
Then if user does not enter anything, you get all team names. If user enters only a part of a name, that would be enough to get the full team name.

Have fun.

---- Andy
 
I'd use this instead:
Where TeamName LIKE '*' & [Enter Team Name] & '*'

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
This is the query today:
Code:
WHERE (((TblMain.Team)=[forms]![frmteamattributes]![teamname]) AND ((TblMain.Mdate) Between [forms]![frmteamattributes]![startdate] And [forms]![frmteamattributes]![enddate]))

how would I incorporate the "Like" and "*" when i am calling these variables from a form?

Thanks for the help, queries are a big week point for me.....

Paul
 

Something like:
Code:
WHERE 
(((TblMain.Team) [blue]LIKE '*' & [/blue][forms]![frmteamattributes]![teamname]) [blue]& '*'[/blue]
AND ((TblMain.Mdate) 
Between [forms]![frmteamattributes]![startdate] 
And [forms]![frmteamattributes]![enddate]))

Have fun.

---- Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top