Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Access expression builder help

  • 23-11-2011 06:54PM
    #1
    Closed Accounts Posts: 47


    hope someone can help. Doing my first access project and stuck on an an expression
    This is for a workshop repair database. I have a field that is restrited to 3 choices, saw-drill-grinder. I have another field that I enter the minutes it took to repair the item. Each item has a different repair cost per minute.

    I want to build an expression to say the follow

    If item=saw them “minutes” * £15 or If item=drill them “minutes” * £10 or If item=grinder them “minutes” * £20


    thanks for the help


Comments

  • Registered Users, Registered Users 2 Posts: 230 ✭✭bellylint


    Hiya, I cant recall how to use the expression builder, its been years since I was an access dev but if you would arent against putting it in as an event procedure this might help.

    If you have three fields on your form. One is a combo box called Tool, it has the items of saw drill and grinder in it, the second is text box called Minutes and the third is a text box called cost.

    if you go to the properties of the minutes text box and go to the events section, double click on the "after update" event and insert the following code


    If Me.Tool = "saw" Then
    Me.Cost = Me.Minutes * 10
    ElseIf Me.Tool = "drill" Then
    Me.Cost = Me.Minutes * 15
    Else: Me.Cost = Me.Minutes * 20
    End If

    It should work.

    good luck.


Advertisement