Results 1 to 3 of 3
  1. #1
    Terryb07 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2015
    Posts
    3

    Using the IIF statement?


    Hello
    I have a form and a blank unbound field. I would like to create a formula that says if a Dept in the Staff field Table is the same as the Dept in the Manager field table, then that is OK otherwise allocate new manager. I keep getting an wrror message when I rey and amke it work. Any ideas?

  2. #2
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,840
    Any ideas?
    not without knowing what code are you using at the moment - and what is your error message?

  3. #3
    Micron is online now Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,366
    Quote Originally Posted by Terryb07 View Post
    Hello
    otherwise allocate new manager. I keep getting an wrror message when I rey and amke it work. Any ideas?
    Also, what do you mean allocate a new manager? You cannot use the IIF function to direct a user to supply an alternate choice of anything. Basically, you can only say "If condition A, then condition B, otherwise condition C." and make something equal the result. If these abstract values you refer to are table/field references then I suggest the following (if not, replace those references with your values).

    something = IIF([tblStaff].[Dept] = [tblManager].[Dept] then [tblStaff].[Dept],"theOtherValue")
    I presume you could use either the Staff or Manager value for the red part since if it passes the first test (returns True) it should not matter which you use as they are equal.
    "Staff field Table" - I'm guessing Staff is a table, but your wording is confusing.

    If you do not have a specific value (alternate) to pass to the function in the case A and B are not equal, I do not see how you can use the IIf function for this.

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

Similar Threads

  1. Replies: 11
    Last Post: 04-29-2015, 01:38 PM
  2. I need help with a IIf Statement!
    By Stho176 in forum Access
    Replies: 3
    Last Post: 10-09-2013, 03:46 PM
  3. In Statement
    By tobe in forum Access
    Replies: 1
    Last Post: 12-04-2012, 02:11 PM
  4. if statement in sql statement, query builder
    By 54.69.6d.20 in forum Access
    Replies: 4
    Last Post: 09-11-2012, 07:38 AM
  5. Replies: 7
    Last Post: 08-17-2011, 01:49 PM

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