Unwanted rounding in a textbox (1 Viewer)

Jmuraski

New member
Local time
Yesterday, 18:49
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
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 16:49
Joined
Oct 29, 2018
Messages
21,541
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?
 

Jmuraski

New member
Local time
Yesterday, 18:49
Joined
Jan 2, 2020
Messages
9
I have posted a sample of my DB.
 

Attachments

  • STIMS.zip
    381.6 KB · Views: 118

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 16:49
Joined
Oct 29, 2018
Messages
21,541
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...
 

Jmuraski

New member
Local time
Yesterday, 18:49
Joined
Jan 2, 2020
Messages
9
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.
 

Gasman

Enthusiastic Amateur
Local time
Today, 00:49
Joined
Sep 21, 2011
Messages
14,447
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
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 16:49
Joined
Oct 29, 2018
Messages
21,541
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

Top Bottom