Results 1 to 7 of 7
  1. #1
    angie is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2013
    Posts
    232

    calcution unbound text box

    Hi I forgot I had another problem that I can not solve.

    unbound text box I want the following to calculated
    If text box [type] = warranty than 9.00 all other type will be 20.00

    so if the text box [type] is warranty than the unbound box will be 9.00
    if the [type] is anything other than warranty than the unbound box will be 20.00



    Thanks Angie

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    txtbox source= IIF([type]='warranty',9,20)

  3. #3
    angie is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2013
    Posts
    232
    that works great, just a question if I wanted to add another type could I ?

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    when you start piling on the IIF options, you may want to do a custom function

    src = getCalc([type])

    Code:
    public function getCalc(pvType)
      select case pvType
         case "warranty"
               getCalc = 9
         case "optn2"
               getCalc = 3
        case else
             getCalc = 20
    end select
    OR make TYPE field a combo box
    the combo will holde the types and the values you want to set.
    in the ON CURRENT event, it will update your text box based on the value in the combo box table.

  5. #5
    angie is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2013
    Posts
    232
    Quote Originally Posted by ranman256 View Post
    when you start piling on the IIF options, you may want to do a custom function

    src = getCalc([type])

    Code:
    public function getCalc(pvType)
      select case pvType
         case "warranty"
               getCalc = 9
         case "optn2"
               getCalc = 3
        case else
             getCalc = 20
    end select
    OR make TYPE field a combo box
    the combo will holde the types and the values you want to set.
    in the ON CURRENT event, it will update your text box based on the value in the combo box table.
    I should have told you this is on a report that is created using a query

  6. #6
    angie is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2013
    Posts
    232
    This is a unbound text box on a report , where would I put the Code?

  7. #7
    angie is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2013
    Posts
    232
    I got it working thank you
    =IIf([type of call]="warranty",9,IIf([type of call]="inspection",9,20))

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

Similar Threads

  1. Add unbound text box
    By BWGreen in forum Forms
    Replies: 4
    Last Post: 05-21-2014, 06:24 AM
  2. Information text on unbound text box
    By randle in forum Forms
    Replies: 3
    Last Post: 06-28-2013, 11:43 AM
  3. Replies: 2
    Last Post: 06-11-2012, 09:37 AM
  4. Unbound Text
    By cbrsix in forum Reports
    Replies: 16
    Last Post: 10-27-2011, 01:27 PM
  5. Unbound text box truncating text
    By gddrew in forum Forms
    Replies: 0
    Last Post: 03-02-2006, 11:26 AM

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