Select query depending on 3 different text boxes (1 Viewer)

kc1

Registered User.
Local time
Today, 10:03
Joined
Sep 22, 2008
Messages
23
Hi All Access Gurus

Got an issue with what I thought would be a simple select query.
On a form called frmMain, there are 3 text boxes that each contain a number.
The query is a group by and sum.
I want to only select the records that don't equal what is in any of the text boxes.
In the criteria I am putting the following:
<>[forms]![frmMain]![textbox1] or [forms]![frmMain]![textbox2] or [forms]![frmMain]![textbox3]
this does not work, however, if I enter the actual numbers in the criteria i.e <>"1" or "2" or "3" it works

I am stumped!

Please help

best regards

KC
 

SOS

Registered Lunatic
Local time
Today, 10:03
Joined
Aug 27, 2008
Messages
3,517
The criteria should actually be AND:

<>[forms]![frmMain]![textbox1] AND <> [forms]![frmMain]![textbox2] AND <> [forms]![frmMain]![textbox3]

And you need the extra <> before each part.
 

kc1

Registered User.
Local time
Today, 10:03
Joined
Sep 22, 2008
Messages
23
Thanks

I will give it a go tomorrow.

So why did it work with OR when I actually entered the numbers?
 

vbaInet

AWF VIP
Local time
Today, 18:03
Joined
Jan 22, 2010
Messages
26,374
Another suggestion:

NOT IN ([forms]![frmMain]![textbox1], [forms]![frmMain]![textbox2], [forms]![frmMain]![textbox3])
 

SOS

Registered Lunatic
Local time
Today, 10:03
Joined
Aug 27, 2008
Messages
3,517
So why did it work with OR when I actually entered the numbers?
I'm thinking that it really didn't work like you thought it did, but due to whatever data you had it APPEARED to work. But it really shouldn't have either because an OR will let the other numbers come through.
 

Users who are viewing this thread

Top Bottom