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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Easy query criteria question
For some reason I can't figure this out. I have two fields in my query
(relevant for this question). [Port Num] (numeric field) and [Type] (text). I need my criteria to say that If [Port Num] = 210 then [Type] "F". What is the suntax to get this to work in the criteria line of the query? I've tried putting the field [Type] and having the criteria be Iif([Port Num] = 210, "F") but that doesn't seem to work. Any help would be appreciated Thanks, Brian |
#2
|
|||
|
|||
Easy query criteria question
Field: PortNum
Criteria: 210 Field: Type Criteria: "F" That will give you all records except those that have a Portnum of 210 and Type of "F" with the exception that records with null values will also be eliminated. IF you want to get the records with a null value in one or the other field then you need to use two more lines of criteria where you enter Is Not Null on line 2 under PortNum and Is Not Null on line 3 under Type. John Spencer Access MVP 2002-2005, 2007-2008 The Hilltop Institute University of Maryland Baltimore County Bongard wrote: For some reason I can't figure this out. I have two fields in my query (relevant for this question). [Port Num] (numeric field) and [Type] (text). I need my criteria to say that If [Port Num] = 210 then [Type] "F". What is the suntax to get this to work in the criteria line of the query? I've tried putting the field [Type] and having the criteria be Iif([Port Num] = 210, "F") but that doesn't seem to work. Any help would be appreciated Thanks, Brian |
#3
|
|||
|
|||
Easy query criteria question
Bongard wrote:
For some reason I can't figure this out. I have two fields in my query (relevant for this question). [Port Num] (numeric field) and [Type] (text). I need my criteria to say that If [Port Num] = 210 then [Type] "F". What is the suntax to get this to work in the criteria line of the query? I've tried putting the field [Type] and having the criteria be Iif([Port Num] = 210, "F") but that doesn't seem to work. Try adding a calculated field to the query: ([Port Num] = 210 And [Type] = "F") and set its criteria to: False -- Marsh MVP [MS Access] |
#4
|
|||
|
|||
Easy query criteria question
On Jun 26, 2:36*pm, Marshall Barton wrote:
Bongard wrote: For some reason I can't figure this out. I have two fields in my query (relevant for this question). [Port Num] (numeric field) and [Type] (text). I need my criteria to say that If [Port Num] = 210 then [Type] "F". What is the suntax to get this to work in the criteria line of the query? I've tried putting the field [Type] and having the criteria be Iif([Port Num] = 210, "F") but that doesn't seem to work. Try adding a calculated field to the query: * * * * ([Port Num] = 210 And [Type] = "F") and set its criteria to: * * * * False -- Marsh MVP [MS Access] Thank you Marshall this worked perfectly. John I had lots of other criteria in the query and could not only include Portfolio 210 so that suggestion would not have worked in my case. Thanks for your help guys, Brian |
Thread Tools | |
Display Modes | |
|
|