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

strWhere = strWhere

Status
Not open for further replies.

spartansFC

Programmer
Apr 1, 2009
165
GB
Hi

I've been trying to sort out this filter by form but can't seem to get it to work the way i want, the search form is one i got from Allenbrowne's website, it works great and the form does filter but it has the wildcard "like" statement in, i need to remove that from the strWhere code so that it only looks at what is selected in the cmbChildStatusSelect.

I've tried just removing the Like ""*" from both sides of the ChildStatusSelect but that creates an error. Can anyone reconfigure the code below so that it just looks at the specific selection in the combo box.

Code:
strWhere = strWhere & "([ChildStatusDesc] Like ""*" & Me.cmbChildStatusSelect & "*"") AND "


thanks

Mikie
 
Firstly:

this code adds the condition in your code to whatever is in the variable, so it will need to be a valid SQL WHERE clause.

Secondly, at the end is the word " AND ".
This will need to be removed if this is the last condition, or another one will need to be added later so that overall, the final where clause is valid.

John
 
So that you can debug, before running your query always debug.print your sql string so you know exactly what is resolved.

strWhere = ...
debug.print strWhere
'look at it to see it makes sense

strWhere = strWhere & "([ChildStatusDesc] = '" & cmbChildStatusSelect "'") AND
 

thanks for the help jrbarnet and MajP, got it working... yay

Mikie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top