Re: The queries look the same in designview??_Again
From: JohnFol (OutlookExpress_at_WibbleObbble.Com)
Date: 03/15/05
- Next message: Hasan: "Using access2000 crosstabs to display in weeks the numbers comes ."
- Previous message: Sri: "Re: To Combine all data from 2 tables"
- In reply to: Ann-Sofie Karlsson: "The queries look the same in designview??_Again"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 15 Mar 2005 16:13:13 GMT
You are applying different logic in the where condition so you will get
different results
For example, the first part of the first query does a logical AND with Type
being anything but a NULL and either value in the brackets being true (the
forms references)
Not Type Is Null AND (Type=Forms!frmSLT!cboObjTypeFilter OR
Len(Forms!frmSLT!cboObjTypeFilter & '')=0)
In the 2nd query you are ANDing it with only one of the expressions.
(Type=Forms!frmSLT!cboObjTypeFilter And Not Type Is Null)
So, the length of cboObjTypeFilter being zeroin the first doesn't matter,
but in the second it does.
"Ann-Sofie Karlsson" <fiaolle@telia.com> wrote in message
news:CdCZd.19721$d5.148658@newsb.telia.net...
> Hi
> I didn't explain myself carefully. The first guestion gives the right
> result
> but the second question doesn't. And I don't understand how they can look
> the same in Access 97:s designview.
>
> I have two queries that look the same in the the designview but has
> different SQL code . The results from the queries are also different. I
> wonder how they can look the same in designview but give different
> results.
> What's the reason?? It should be in the SQL code but I can't see it.
>
> Here are the two queries
>
> SELECT MSysObjects.Name ,Type FROM MSysObjects
> WHERE Not Type Is Null AND (Type=Forms!frmSLT!cboObjTypeFilter OR
> Len(Forms!frmSLT!cboObjTypeFilter & '')=0) And Left$([Name],1)<>'~'
> ORDER BY Type, MSysObjects.Name;
>
> SELECT MSysObjects.Name , Type FROM MSysObjects
> WHERE (Type=Forms!frmSLT!cboObjTypeFilter And Not Type Is Null) AND
> Left$([Name],1)<>'~' OR Left$([Name],1)<>'~' AND
> Len(Forms!frmSLT!cboObjTypeFilter)=0
> ORDER BY Type, MSysObjects.Name;
>
> Please help
>
> Fia
>
>
- Next message: Hasan: "Using access2000 crosstabs to display in weeks the numbers comes ."
- Previous message: Sri: "Re: To Combine all data from 2 tables"
- In reply to: Ann-Sofie Karlsson: "The queries look the same in designview??_Again"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|