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

subquery

Status
Not open for further replies.

sabavno

Programmer
Jul 25, 2002
381
CA
Hi,

I have this subquery that does not work

If anyone could take a look at that, I'd appreciate it

SELECT NewQuery.Name1, NewQuery.TRANSIT, NewQuery.OP_STATUS, NewQuery.GL_INPUT_TYP
FROM NewQuery
where NewQuery.Name1=
IIf([Count([NewQuery.Name1])=2,[Name1]<>&quot;RBFG&quot;,[Name1])

Thanks
 
Everything is fine up until you get to your Iif statement

&quot;IIf([Count([NewQuery.Name1])=2,[Name1]<>&quot;RBFG&quot;,[Name1])&quot;

Firstly you have a braket that shouldnt be there (see in red)

Also, you can't use a criteria expression when trying to returning a single value (see text in red). Is what you wanted was to do two criteria checks? (Name Count > 2 and Not Equal to &quot;RBFG&quot;) If so, then you'll have to nest two Iif statements together to handle this. I might have it all wrong, if so please explain what you need your query to achieve.
[yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top