Unwanted rounding in a textbox

Jmuraski

New member
Local time
Today, 01:30
Joined
Jan 2, 2020
Messages
9
Hi all,

I have a data entry form that has several text boxes and a combobox on it for recording production data. I have one textbox that is auto-filled based on the value selected in the combobox. I have it autofill by using the value in the second column of the combobox. The combobox is populated by the results of a query. The query returns all of the expected values. Column 1 is text and column 2 are number values to 2 decimal places (such as 4.56).

However, whenever a value in the combo is selected and the text box fills with the required data, it rounds the value. For example, 4.56 gets rounded to 5.00 (showing the 2 decimal places) and I cannot figure out why or how to prevent it. Does anyone know what I am missing?

Code to fill the textbox:
Private Sub prodFamily_Change()

Me.goalRate = Me.prodFamily.Column(1)

End Sub
 
Hi. It might take looking at all the properties of the combo and the textbox. Are you able to post a sample copy of your db to show this problem?
 
I have posted a sample of my DB.
 

Attachments

Never mind. If it's the same db, then I looked at the design view of the prodData form, which is bound to the prodData table. The goalRate field in this table is set as a Long Integer data type. So, when you assign a decimal value to it, the value gets rounded up. Hope that helps...
 
It is in fact the same db. I just changed that field to a Double and it worked! Thanks a bunch! It was something simple.
 
It is in fact the same db. I just changed that field to a Double and it worked! Thanks a bunch! It was something simple.

The 'simple' things are sometimes the hardest to track down. :D
 
It is in fact the same db. I just changed that field to a Double and it worked! Thanks a bunch! It was something simple.
Hi. I agree with Gasman, that's why we sometimes ask to see a sample copy of the db to help find the problem faster. Glad to hear you got it sorted out. Good luck with your project.
 

Users who are viewing this thread

Back
Top Bottom