Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 use sql statemetn to query subform.
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

1 Posts

Posted - 11/16/2006 :  18:06:45  Show Profile  Reply with Quote
I would like to filter a subform by using a sql statement in vba.

I want to be able to say. afterupdate on a combo box. select "*" where[excd]<>"ne" and [billstatus] = bu then select the items where [excd]="Ne" and [billstatus]<>= bu.

What I want is all the "BU bill status that [excd] does not equal "ne" and all the items were {excd] = ne but the bill status does not equal bu.

Hope H.

Constraint Violating Yak Guru

391 Posts

Posted - 11/17/2006 :  13:39:17  Show Profile  Reply with Quote

select * from yourtable y 
  where (y.excd <> 'ne' and y.billstatus = 'bu') or (y.excd = 'ne' and y.billstatus <> 'bu)

EDIT: Put in aliases I missed.


Edited by - KenW on 11/17/2006 13:52:36
Go to Top of Page

Premature Yak Congratulator

22864 Posts

Posted - 11/18/2006 :  04:45:33  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
>>EDIT: Put in aliases I missed.

You dont need alias until you join it with other table


Failing to plan is Planning to fail
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000