Solved Currency Rounding Up

Emma35

Registered User.
Local time
Today, 15:03
Joined
Sep 18, 2012
Messages
497
Hi again......i've been working on a small database which has been frustrating the hell out of me. I thought we had it done but now another small issue has popped up. If you look at the order form in the attached file, the Cost txt box in the subform will not display the cents part of the price in euros even though i have it set for two decimal places ?. I don't understand why this should be the case and this seems a pretty trivial thing to be bothering you guys with. If someone coukd have a quick look i'd be grateful
Thanks
 

Attachments

Well you appear to be updating the product table on the fly? :(

I changed one entry to have some cents and lo and behold it completely disappeared.?

Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
    If CDbl("0" & Me.txtCost) > 0 Then
        CurrentDb.Execute "update tbl_products set price = " & CDec(Me.txtCost) & " where productID = " & Me.cboProducts & ";"
    End If
End Sub

Plus your orderdetails table has Decimal.? If I change it to double I get the cents stored.

I uncommented the beforeupfdate code and it still works, so try setting the field formats correctly.?

HTH

Edit. As you have Currency in the product table, why are you not using that in the orderdetails table?
 
did you set it's Decimal Places property in design view to 2?
 
yes, mr. gasman if set to Auto it will not display the decimal part if the decimal part is 0.
with set to any number it will show the decimal part even when 0.
 
Well the products did not even have any cents to start with. :D
 
Guys as usual thank you all for taking a look.
Gasman...your suggestion with the OrderDetails table fixed it. I swear i checked and double checked EVERYTHING except that 😄
arnel...good to know we're still pals 😘
 

Users who are viewing this thread

Back
Top Bottom