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

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 use sql statemetn to query subform.

Author  Topic 

favor08
Starting Member

1 Post

Posted - 2006-11-16 : 18:06:45
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.

KenW
Constraint Violating Yak Guru

391 Posts

Posted - 2006-11-17 : 13:39:17
[code]
select * from yourtable y
where (y.excd <> 'ne' and y.billstatus = 'bu') or (y.excd = 'ne' and y.billstatus <> 'bu)
[/code]

EDIT: Put in aliases I missed.

Ken
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-11-18 : 04:45:33
>>EDIT: Put in aliases I missed.

You dont need alias until you join it with other table

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -