Results 1 to 6 of 6
  1. #1
    sgtclark is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2020
    Posts
    24

    Text Box Expression

    I have a form that I am building a text box to display what the current status is based on the users inputs to assist with their selection of what they intend to report. Using a series of IIf statements to determine how their selections will be reported. I have all of them working except 1.



    =IIf(([Total# of 111 Days] Is Null Or [Total# of 111 Days]<>[Unit Reported # Days to be Used]) And [ATStatus]="Conducting Less Than 15 Days of AT (Remarks Required with total #days to be utilized)","< 15 Day Order Unit Reported","Error")

    The Highlighted part of the expression is what I have determined is the fault. Both are Number fields and what it should be doing is determining if one field is NOT EQUAL TO the other (i.e. 4 does not equal 3). Can anyone tell me what I am doing wrong?







  2. #2
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,557
    This section looks wrong:-

    "< 15 Day Order Unit Reported",

    It should be:-

    < "15 Day Order Unit Reported",

  3. #3
    sgtclark is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2020
    Posts
    24
    That is or what I believe to be the "True" statement and returns the text "< 15 Day Order Unit Reported". It is not an argument of less than. When I remove this from he argument it returns the desired "True" statement Or [Total # of 111 Days]<>[Unit Reported # Days to be Used]

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,398
    you have not highlighted the code - I presume you mean this bit

    ([Total# of 111 Days] Is Null Or [Total# of 111 Days]<>[Unit Reported # Days to be Used])

    you haven't said what is being returned - the wrong result or an error

    be aware that both sections need to be tested - so if
    [Total# of 111 Days] is null you have 'is null' =true and null<>6 (whatever) which will fail in that it will return null, not true or false so summarised you have these possible outcomes

    (true or null) and true=true
    (false or true) and true=true
    (false or false) and true=false
    (true or null) and false=false
    (false or true) and false=false
    (false or false) and false=false

    note that using non alphanumeric characters in field names can produce misleading errors/unexpected results. Using the square brackets usually solves the problem but there are instances when it doesn't.





  5. #5
    sgtclark is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2020
    Posts
    24
    Yes this specifically is what will not return a "True" result, [Unit Reported # Days to be Used]<>[Total # of 111 Days]

    I have tested it by itself as =IIf([Unit Reported # Days to be Used]<>[Total # of 111 Days] And [AT Status]="AT Status- Conducting Less Than 15 Days of AT (Remarks Required with total # days to be utilized)","< 15 Days Not Matching Unit Reported","Error")

    And it will only show as "False" or as I have the False as Error.

  6. #6
    sgtclark is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2020
    Posts
    24
    Disregard …….this was my issue...….AT Status- …..should not have been in this text [AT Status]="AT Status- Conducting Less Than 15 Days of AT (Remarks Required with total # days to be utilized)"

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 07-12-2013, 09:17 AM
  2. Expression for a text box
    By venu_resoju in forum Reports
    Replies: 4
    Last Post: 01-24-2013, 10:27 PM
  3. Expression Help - Pulling a number from a text box.
    By MintChipMadness in forum Access
    Replies: 6
    Last Post: 08-08-2012, 02:11 PM
  4. text box expression inserted to table
    By normie in forum Access
    Replies: 3
    Last Post: 03-13-2012, 04:14 PM
  5. Text Box Expression Builder with Queries
    By blacksaibot in forum Access
    Replies: 7
    Last Post: 01-10-2012, 10:07 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums