Return all rows

davebhoy

Dave
Local time
Today, 10:45
Joined
Aug 1, 2006
Messages
37
I hope this is a simple query becuase my brain has drawn a blank on it.

I have a query with a parameter which a form textbox. If the text box has X value I want to use one list of parameters and if has Y I want to list all rows in the query.

Any help appreciated!

Dave
 
I did something like this about 5 years ago. I created a global function that returned the value from the text box if there was something in the text box and * if the textbox was empty. Then the parameter in the query was set to Like Function().
 
Thanks

If I return a value like <>value the query doesn't treat this as if you input <>value as a direct parameter in the query!
 
davebhoy said:
If I return a value like <>value the query doesn't treat this as if you input <>value as a direct parameter in the query!

Please try to rephrase this; I don't understand what you are trying to say.
 
Sorry Grnzbra, forget the original quote, my problem has changed here

I'm trying to return a value in the text box which is <>"LOANS" and <>"RENTS". the query then uses this text box as a parameter but it must be treating it as one single text block because it returns no rows at all!

I've spent the whole day at this, aghhh!

Dave
 
Perhaps the query is trying to include the <> in the criteria. I think it will see the output of the text box as "<>Rents" or something like that.

Try setting a string variable equal to the text box and see what you get. If that is what is happening, you may need to play with modifying the WHERE clause of the query definition.
 
Thanks, that is what's happening.

how do I set a string variable equal to the text box?
 
If you are using the form's module, I think it would be

strvar = Me.Textbox or perhaps
strvar = Me.Textbox.Text
 

Users who are viewing this thread

Back
Top Bottom