Type conversion failure when updating a query in Access

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • teresat
    New Member
    • Dec 2015
    • 1

    Type conversion failure when updating a query in Access

    I tried to update a query by simplying increasing the price by 7.25% which I entered as formula as "Costprice(BN)* 1.0725" where Costprice(BN) is the field name. An error message came up as type conversion failure

    I looked it up but I think it has to do with how I imported the file. If someone could help that would be great. An explanation in lay man's language would be great as i am really struggling with the terminology
  • mbizup
    New Member
    • Jun 2015
    • 80

    #2
    --> where Costprice(BN) is the field name

    Is your field really named "Costprice(BN)" ? Or is this a separate function called Costprice being executed on a field called BN?

    If you have indeed named your field Costprice(BN), please rename it to CostpriceBN. You should never use special characters in your fieldnames, even though Access may allow this.

    Parentheses have special meaning -- they indicate functions and subs.

    So try renaming the field to CostpriceBN, and see if your original syntax CostpriceBN * 1.0725 works.

    If you still have a type conversion error, try this (convert the field to a double):
    Code:
    CDbl(CostpriceBN) * 1.0725
    If that fails, try this to handle nulls...
    Code:
    CDbl(NZ(CostpriceBN,0)) * 1.0725

    Comment

    Working...