Re: The queries look the same in designview??_Again

From: JohnFol (OutlookExpress_at_WibbleObbble.Com)
Date: 03/15/05


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
>
>



Relevant Pages

  • The queries look the same in designview??_Again
    ... I have two queries that look the same in the the designview but has ... The results from the queries are also different. ... It should be in the SQL code but I can't see it. ... SELECT MSysObjects.Name, Type FROM MSysObjects ...
    (microsoft.public.access.queries)
  • Still doesnt understand the querys designview
    ... I still don't understand why the first query look like it does in the designview. ... SELECT MSysObjects.Name, Type FROM MSysObjects ... The first query should look like figure1: ...
    (microsoft.public.access.queries)
  • Re: The queries look the same in designview??
    ... These queries have unbracketed AND and OR phrases in the WHERE clause. ... > I have two queries that look the same in the the designview but has ... It should be in the SQL code but I can't see it. ... > SELECT MSysObjects.Name, Type FROM MSysObjects ...
    (microsoft.public.access.queries)
  • The queries look the same in designview??
    ... The results from the queries are also different. ... wonder how they can look the same in designview but give different results. ... It should be in the SQL code but I can't see it. ... SELECT MSysObjects.Name, Type FROM MSysObjects ...
    (microsoft.public.access.queries)
  • Re: Running queries one after the other
    ... > event code as follows to run two Queries, ... > changed something and forgot to retest it at the time. ... > The first query is called Append School Offers to Archive ... The form that calls the queries? ...
    (microsoft.public.access.queries)

Loading