Results 1 to 8 of 8
  1. #1
    cap.zadi is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2011
    Location
    KSA
    Posts
    481

    IIF Function in a form?

    Dears,



    Hope you all of are fine and sorry to bother you regarding my questions here.

    i would like to ask today about the IIF function which i want to put in a form like wise.

    I have the follwoing fields;

    Sample No, Reading, Leakage, Stnd Values, Results,
    1 0.048 Not Found 0.07 Passed


    suppose if there is stnd values set for a test is 0.07 and have +5% allowance so when data is entered in the "Reading" field it should filled up the "Leakage" and "result" fields, there was "no leakage found" and "faild or passed" vice versa.

    hope to get the reply.

    thanks

    zee

  2. #2
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    In your Leakage Textbox, place this calculation:

    =iif([Reading]<([Stnd Values]-[Stnd Values]*.05) or [Reading]>([Stnd Values]+[Stnd Values]*.05),"Leakage Found","No Leakage Found")

    and a similar formula for the results field.

    Alan

  3. #3
    cap.zadi is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2011
    Location
    KSA
    Posts
    481
    thanks man. it works nice.

  4. #4
    cap.zadi is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2011
    Location
    KSA
    Posts
    481
    Hello Sir there.

    The above formula is working fantastic but the results are not saved in table and cant be seen in reports also. just it can be print out from the form. plz advise.

  5. #5
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    Calculations should not be saved in tables. That is bad database practice. If you wish to see the results in a report, then make a query and put the calculation in a new field and then use the query as your record source for your report instead of your table.

    In the QBE, in a new column, type Leakage: =iif([Reading]<([Stnd Values]-[Stnd Values]*.05) or [Reading]>([Stnd Values]+[Stnd Values]*.05),"Leakage Found","No Leakage Found")
    and then do the same for the Results.

    Alan

  6. #6
    cap.zadi is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2011
    Location
    KSA
    Posts
    481
    Ok sir, i do agree with u and it looks nice way. but i need to print this form after finish the transaction bcz its a laboratory database. So how to make this form which also part of master table and query which shows results on form?

    thanks

  7. #7
    cap.zadi is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2011
    Location
    KSA
    Posts
    481
    sorry for misunderstanding. in form print it show the results and also print. so i already set those fields through a query and it appears now in report.

    thanks

    zee

  8. #8
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    Happy to hear that you solved it.

    Alan

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

Similar Threads

  1. Replies: 4
    Last Post: 08-05-2011, 07:27 AM
  2. Form command button to do something/call function
    By shubhamgandhi in forum Programming
    Replies: 2
    Last Post: 07-27-2011, 04:45 PM
  3. Group By Function on a Form
    By amcalabrese in forum Access
    Replies: 0
    Last Post: 03-26-2011, 08:45 AM
  4. Access Form If Function
    By cs93 in forum Forms
    Replies: 1
    Last Post: 03-23-2011, 02:33 PM
  5. Switchboard open form based on function value
    By silverspr in forum Forms
    Replies: 5
    Last Post: 03-10-2011, 02:10 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