checkbox to switch between discount and no discount on form

Posted on 2004-10-22
Last Modified: 2012-05-05
I am very very new to access and have bludgeoned my way through making an invoiceing system for our workshop but cannot work out how to do this last bit which I assume would be in vb in the way of an IF statement.
On the form there are 5 text boxes:

Total (Ex-Tax): =OrdersSF.Form!txtTotal
              GST:  =[txtTotal]*0.1
   Order Total:  =[txtSalesTax]+[txtTotal]
Discount 10%:
 Invoice Total:  =[txtOrderTotal]-[txtDiscount]

On the form beside the Discount 10% entry is a checkbox and I would like it to display a 10% discount from the order total when checked and retotal the amount to the Invoice total, and when unchecked put a 0 discount in the discount and display the order total in the invoice total without the discount removed.
As I said I am not really sure as to what needs to be done be it a new query or code but any help would be great.
I hope I have explained what I need well enough to get some help on this.

The Pro

Question by:The_Professional
    LVL 9

    Accepted Solution

    create you checkbox called chkDiscount and set its default value to False, create your txtDiscount and set it default value to 0
    on the event for the checkboxs add this code:-

    Private Sub chkDiscount_Click()
    Dim curTax As Currency
    Dim curTotal As Currency
    If Me.chkDiscount = True Then
        curTax = Me.txtSalesTax
        curTotal = Me.txtTotal
        Me.txtDiscount = (curTax + curTotal) * 0.1
        Me.txtDiscount = 0
    End If
    End Sub


    LVL 3

    Author Comment

    Thanx Peter worked perfectly your help is much appreciated.

    The Pro
    LVL 9

    Expert Comment

    Thanks for the Grade and points :-)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

     Java Android Coding Bundle

    Whether you're an Apple user or Android addict, learning to code for the Android platform is an extremely valuable, in-demand skill. It all starts with Java, the language behind the apps and games that make Android the top platform it is today.

    Suggested Solutions

    Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
    Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
    Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
    With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

    931 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now