Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2004
    Posts
    85

    Unanswered: please correct my formula

    =[time]*15 Or [time] * 20 if [state] = Queensland

    thats what im trying to say


    thanks for your time in advance

  2. #2
    Join Date
    Jun 2004
    Posts
    92
    In the control source of the text box you want to display the result put =readtime() then add this function to your form.

    Code:
    Private Function readtime()
    If state = "Queensland" Then
    readtime = time * 20
    Else
    readtime = time * 15
    End If
    End Function
    There might be a way to do it as an expression but I don't know it.

  3. #3
    Join Date
    Apr 2004
    Posts
    85
    where do i put the function?

  4. #4
    Join Date
    Nov 2003
    Posts
    1,487

    Smile

    =IIF([state] = "Queensland", [time]*20, [time]*15)



  5. #5
    Join Date
    Apr 2004
    Posts
    85
    Thanks CyberLynx, i thought IIF was the IF Statement..
    anyway thanks alot..

    * Whips out the Gold Star and sticks it on ya Forehead

    yes there is more GoldStars...

  6. #6
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    iif = immediate if

    iif(condition, result if true, result if false)
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  7. #7
    Join Date
    Nov 2003
    Posts
    1,487
    The IIF statement is very much the same thing as the IF statement in the sense that it processes conditions in a similar fashion. IIF is a shorter version of the IF statement and can be placed directly into a Control Source property (for example) whereas the IF statement will need to be placed into a Function before it can be handled by the Control Source property.


    IIF([state] = "Queensland", [time]*20, [time]*15)

    is the same as

    IF [state] = "Queensland" Then
    Me.myControlName = [time]*20
    Else
    Me.myControlName = [time]*15
    End If

    You can quickly see which is easier to use especialy for your specific application.

    Last edited by CyberLynx; 08-23-04 at 13:59.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •