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

Passing query criteria with a text box

Status
Not open for further replies.

Gerbers404

Programmer
Jun 11, 2001
84
US
Hello,

Having a little bit of a problem here.

I have an option group with 3 options, MN, CA, and Both.
On the mouse down event of those buttons, I have them populate a (hidden) text box. I reference this text box as the criteria for a query (in the qurey builder) that I run a report from.

My problem is that I cannot seem to find the appropriate phrase to populate the text box with that will give me the information for the "Both" condition. For the MN option button, it places MN in the text box. For CA, it places CA. These work fine and give me the info i'm looking for. However, everything I've tried for the "Both" option returns no records and gives me an empty report.

I've tried 'Is Not Null', and 'MN or CA', '<>&quot;&quot;', and '<>0' to name a few. None of these work. When I actually put 'Is Not Null' or 'MN or CA' into the criteria field of the query builder, everything works fine. It just does not work when I reference the textbox that has either of these two phrases in it.

I know I could store a bunch of SQL statements and call them, but it seem to me that this would be a faster fix if I could get it to work.

Does anyone have any ideas that could help me out?

Thank you for your time.

Gerbers404
 
Try &quot;MN&quot; or &quot;CA&quot;. You said you tried &quot;MN or CA&quot; but that isn't a possible value. Hope this helps.

Jim DeGeorge [wavey]
 
Jim,

Thank you for the suggestion, but that hasn't worked either. I think the problem has soemthing to do with sending 2 different criteria to the query grid. Think I will add another hidden text box to the form and reference it in the &quot;or&quot; field of the query builder. I figure if I have the 'Both' option button poulate &quot;MN&quot; in one textbox and &quot;CA&quot; in the other, it should work. I am still confused as to why Is Not Null wouldn't work. Perhaps it tries to pass as a string to the query builder and it's not supposed to? I don't know.

Thanks again for your response Jim!

Gerbers404
 
Your query grid probably has something like &quot;[forms]![FORM NAME]![FIELD NAME]&quot; as the criteria.

If the option values can be &quot;MN&quot; &quot;CA&quot; &quot;BOTH&quot;, you can use &quot;like 'MA' or 'CA'&quot; as the 3rd value, and if that's sent to the query (including the double quotes) it should work.

Jim DeGeorge [wavey]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top