Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2004
    Posts
    36

    Unanswered: DLookup and show respective value on every record

    I have a Yes/No field for Tax in my table. Records that have this field checked will have 5% of tax added to its total cost. I did a DLookup on the On_Current event of the form and it does not work. My code is as follows,

    Code:
        Dim bTaxIncluded As Boolean, nTaxAmount As Currency
        
        ' determine if tax was added
        bTaxIncluded = Nz(DLookup("[GST]", "tblOrderInfoMain", "[PONumber]='" & txtPONumber & "'"), False)
        MsgBox bTaxIncluded
        
        ' figure tax amount
        nTaxAmount = IIf(bTaxIncluded, 0.05 * [SubFrmLookupRecords].[Form]![txtSumTotalCost], 0)
        txtGST = nTaxAmount
        txtGrossTotal = [SubFrmLookupRecords].[Form]![txtSumTotalCost] + nTaxAmount
        MsgBox "GST = " & nTaxAmount
    When the form loads, even if the record has its Tax Yes/No checked in the table, $0 is displayed for the tax field. I have uploaded a db for better understanding of my problem. Can anyone help me in this? Any guidance or help would be deeply appreciated. Thanks in advance.

    Regards,
    Swee
    Attached Files Attached Files

  2. #2
    Join Date
    Mar 2004
    Location
    belgium
    Posts
    290
    well i checked your db1.zip, but as far as i can see it works fine.

    when i open the form i get the message true (first rec), after I click OK then the msg GST appears with 0,05, clicked OK and the finalsum, GST and total+Gst are filled accordingly the calculations.

  3. #3
    Join Date
    Aug 2004
    Posts
    36
    You actually saw that?! When I use it on my PC, it shows $0.00, not $0.05. Is it a different version of Access that's the problem?

  4. #4
    Join Date
    Mar 2004
    Location
    belgium
    Posts
    290
    i am using windowsXP access 2003

  5. #5
    Join Date
    Aug 2004
    Posts
    36
    Have you any idea why I can't see the calculations? I'm at a loss.

  6. #6
    Join Date
    Aug 2004
    Posts
    36
    I'm using Access 97.

Posting Permissions

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