Results 1 to 12 of 12
  1. #1
    Malikei29 is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Aug 2017
    Posts
    10

    Iif function

    HI,

    I am new to Access, I have a bit of Excel Knowledge though.

    My question or query is this

    If I have a section in my form that is only applicable to certain people, (I.E: If someone has medical aid) can I use the "IIF" function to allow them to enter their details, but If their option is "NO" it must not be a required option.



    So basically:

    Medical Aid: if YES - all info required
    if NO - no info required

    Please if anyone can assist, I have been struggling on this for a few weeks.

    Malikei29, OUT

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,643
    You can affect the visibility if you want:

    http://www.baldyweb.com/ConditionalVisibility.htm

    Regarding it being required, that I'd do in the before update event of the form:

    http://www.baldyweb.com/BeforeUpdate.htm

    Obviously first testing that control, if Yes then test the others.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Malikei29 is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Aug 2017
    Posts
    10
    thank you so much, I will try it out.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,643
    No problem, post back if you get stuck. Welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Malikei29 is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Aug 2017
    Posts
    10
    If one views the Image below, you can see that in the first tab it says "Medical Aid Option". The choice is either "YES" or "NO".


    Click image for larger version. 

Name:	IIF FUNCTIONS.jpg 
Views:	27 
Size:	23.0 KB 
ID:	30168

    Now what I want to accomplish is:

    If the option is "YES" then all the details need to be fill in as above, (Obviously the information will be different for each person.)

    BUT....

    If the option is "NO" then all the details can be ignored.

    In my table I have set the Field properties "Required" to yes.

    So I cant leave it blank.

  6. #6
    Malikei29 is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Aug 2017
    Posts
    10
    Thanks, I sent a screen shot of what I want to do.

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,643
    Did you try any of the suggested code? You can't set those fields to required if they won't always be filled out.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    Malikei29 is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Aug 2017
    Posts
    10
    Ok I will the the required option.

    Where would I enter those codes. I don't quiet understand the code syntax.
    Could you explain it to me.

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,643
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    Malikei29 is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Aug 2017
    Posts
    10
    I have tried using those codes you sent me,pbaldy, but I still cant get it right.
    Is there maybe an easier way on doing what I require. I'm not clued up on VB at all.

  11. #11
    Malikei29 is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Aug 2017
    Posts
    10


    I have created a combo box in a form and a table, with the options "yes" or "no"

    If the "yes" Option is chosen, then I want all the Medical Aid Details visible or required

    If the "no" option is chosen, then I don't want the medical Aid Details visible or required.

  12. #12
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,643
    I'll close this thread since you've started another:

    https://www.accessforums.net/showthread.php?t=67831
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 15
    Last Post: 05-31-2017, 02:10 PM
  2. Replies: 2
    Last Post: 02-26-2017, 11:31 AM
  3. Replies: 3
    Last Post: 03-04-2016, 10:36 AM
  4. Replies: 8
    Last Post: 11-04-2014, 10:44 PM
  5. Replies: 8
    Last Post: 01-31-2014, 01:45 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