UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Query If Or Statement Not Working Like Should?, Access 2010    
 
   
techexpressinc
post May 16 2018, 04:05 PM
Post#1



Posts: 376
Joined: 6-October 08
From: indiana, usa


I am not getting the expected result any ideas?

Attached is the query formula and the results.

Thanks

Russ



Attached File(s)
Attached File  QUERY_QUESTION_5_16_18.JPG ( 21.5K )Number of downloads: 17
Attached File  QUERY_QUESTION_5_16_18_PIC2.JPG ( 18.01K )Number of downloads: 0
 

--------------------
Thanks,
Russ Neuman, Insurance designations = FLMI, ASC, ALMI
Certified MS-Office Specialist
Go to the top of the page
 
Doug Steele
post May 16 2018, 04:20 PM
Post#2


UtterAccess VIP
Posts: 21,853
Joined: 8-January 07
From: St. Catharines, ON (Canada)


You've got a space in Auto Enroll inside the IIf statement, whereas the field name shown in the query grid seems to be AutoEnroll, although I would have expected you to be prompted to supply a value for Auto Enroll.

--------------------
Doug Steele, Microsoft Access MVP (2000-2018)
http://www.accessmvp.com/DJSteele/AccessIndex.html
Co-author: Access Solutions: Tips, Tricks, and Secrets from Microsoft Access MVPs, published by Wiley
Co-author: Effective SQL: 61 Specific Ways to Write Better SQL, published by Addison-Wesley Professional
Technical Editor: Access 2010 Bible, Access 2013 Bible, Access 2016 Bible, all published by Wiley
Technical Editor: SQL Queries for Mere Mortals: A Hands-On Guide to Data Manipulation in SQL, 4th Edition, published by Addison-Wesley Professional
Go to the top of the page
 
kfield7
post May 17 2018, 08:37 AM
Post#3



Posts: 866
Joined: 12-November 03
From: Iowa Lot


Yet the output in the attached image shows the space.
Go to the top of the page
 
Doug Steele
post May 17 2018, 09:06 AM
Post#4


UtterAccess VIP
Posts: 21,853
Joined: 8-January 07
From: St. Catharines, ON (Canada)


That doesn't really prove anything, kfield7. There could be a caption on the field that would do that.

--------------------
Doug Steele, Microsoft Access MVP (2000-2018)
http://www.accessmvp.com/DJSteele/AccessIndex.html
Co-author: Access Solutions: Tips, Tricks, and Secrets from Microsoft Access MVPs, published by Wiley
Co-author: Effective SQL: 61 Specific Ways to Write Better SQL, published by Addison-Wesley Professional
Technical Editor: Access 2010 Bible, Access 2013 Bible, Access 2016 Bible, all published by Wiley
Technical Editor: SQL Queries for Mere Mortals: A Hands-On Guide to Data Manipulation in SQL, 4th Edition, published by Addison-Wesley Professional
Go to the top of the page
 
techexpressinc
post May 17 2018, 12:25 PM
Post#5



Posts: 376
Joined: 6-October 08
From: indiana, usa


I flipped the TRUE FALSE values to Yes No - and proof - the same formula works. Those True False values always seem rough to work with.
This post has been edited by techexpressinc: May 17 2018, 12:29 PM
Attached File(s)
Attached File  WORKS_NOW_5_17_18.JPG ( 16.52K )Number of downloads: 0
Attached File  MAKEFIELDS_YES_or_NOMAY2018.jpg ( 11.72K )Number of downloads: 3
Attached File  FORMULA_5_17_18.JPG ( 14.04K )Number of downloads: 5
 

--------------------
Thanks,
Russ Neuman, Insurance designations = FLMI, ASC, ALMI
Certified MS-Office Specialist
Go to the top of the page
 
techexpressinc
post May 17 2018, 12:40 PM
Post#6



Posts: 376
Joined: 6-October 08
From: indiana, usa


table field name has a space in the name.
Attached File(s)
Attached File  FIELD_DEF_MAY2018.jpg ( 12.76K )Number of downloads: 0
 

--------------------
Thanks,
Russ Neuman, Insurance designations = FLMI, ASC, ALMI
Certified MS-Office Specialist
Go to the top of the page
 
June7
post May 17 2018, 12:59 PM
Post#7



Posts: 60
Joined: 25-January 16



So issue resolved?

Field name does not have space, it's Caption has space.

Should be consistent. Some of your Captions have space and some don't. I never set Caption property in table. I set Caption property of label on form or report.
This post has been edited by June7: May 17 2018, 01:00 PM
Go to the top of the page
 
tina t
post May 17 2018, 03:27 PM
Post#8



Posts: 5,474
Joined: 11-November 10
From: SoCal, USA


QUOTE
I flipped the TRUE FALSE values to Yes No - and proof - the same formula works. Those True False values always seem rough to work with.

True/False is not the same as "Yes"/"No". the issue is the data type. since your IIf() expression works correctly when you test for the string value "Yes", then the table fields named AUTO_ENROLL and SAFE_HARBOR must be Text data type. if you want to test for boolean True/False values, then you need to use the boolean data type for your table fields.

the data type of the value you're using to test a field value, must always match the data type of the field that stores the value.

hth
tina

--------------------
"the wheel never stops turning"
Go to the top of the page
 
techexpressinc
post May 18 2018, 07:59 AM
Post#9



Posts: 376
Joined: 6-October 08
From: indiana, usa


Thank you all for your help.

I agree on the field set-up caption, but as usually this is an old DB 10-years- and I am here to do work quick and move on to the next task in the hopper.

Yes Resolved.

Russ yayhandclap.gif





This post has been edited by techexpressinc: May 18 2018, 08:01 AM

--------------------
Thanks,
Russ Neuman, Insurance designations = FLMI, ASC, ALMI
Certified MS-Office Specialist
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    16th August 2018 - 01:02 AM