A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Exclude data from field, when another field equals a certain numbe



 
 
Thread Tools Display Modes
  #1  
Old April 28th, 2010, 03:24 PM posted to microsoft.public.access.queries
MacNut2004
external usenet poster
 
Posts: 73
Default Exclude data from field, when another field equals a certain numbe

Hello,

I have 2 fields. I have Job # and GL #.

I need to exclude from the GL field, values that are 1234, but ONLY if the
Job # = 999999.

I have tried using this formula in the criteria of the GL# field in my query:

IIf([Job #]=999999,1234,[GL #])

and instead of 999999 still showing up in the query and excluding GL# 1234,
999999 doesn't show up at all!

What am I doing wrong??

Thank you!!!!!!!!

MN
  #2  
Old April 28th, 2010, 04:24 PM posted to microsoft.public.access.queries
Jerry Whittle
external usenet poster
 
Posts: 4,732
Default Exclude data from field, when another field equals a certain numbe

IIf([Job #]999999, [GL #], IIf([GL #]=1234, Null, [GL #]))

I'm assuming by exclude that you mean Null.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


"MacNut2004" wrote:

Hello,

I have 2 fields. I have Job # and GL #.

I need to exclude from the GL field, values that are 1234, but ONLY if the
Job # = 999999.

I have tried using this formula in the criteria of the GL# field in my query:

IIf([Job #]=999999,1234,[GL #])

and instead of 999999 still showing up in the query and excluding GL# 1234,
999999 doesn't show up at all!

What am I doing wrong??

Thank you!!!!!!!!

MN

  #3  
Old April 28th, 2010, 06:57 PM posted to microsoft.public.access.queries
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Exclude data from field, when another field equals a certain numbe

On Wed, 28 Apr 2010 07:24:06 -0700, MacNut2004
wrote:

Hello,

I have 2 fields. I have Job # and GL #.

I need to exclude from the GL field, values that are 1234, but ONLY if the
Job # = 999999.

I have tried using this formula in the criteria of the GL# field in my query:

IIf([Job #]=999999,1234,[GL #])

and instead of 999999 still showing up in the query and excluding GL# 1234,
999999 doesn't show up at all!

What am I doing wrong??

Thank you!!!!!!!!

MN


You can't pass an operator such as in this way. Could you post the entire
SQL of the query? I would guess you will need a clause such as

([Job #] = 999999 AND [GL #] 1234) OR ([Job #] 999999)
--

John W. Vinson [MVP]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:52 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.