I'm trying to get a value from a field, I don't know why is rounded
rs.Open myQuery, cnn
i = 1
Do While rs.EOF = False
S1 = rs.Fields("S1")
Cells(i, 1) = S1
i = i + 1
rs.Next
Loop
For example, in the database S1 is 8.567 but I always get 8
Is there a way to define the data type from that field?
Thank you!
I found the solution, in your query you have to define the type of data you want to have.
Then you will get newValue with decimals.
Declare and assign your variables properly.
I don't like the orphaned
Cells(i, 1)
either. That should have a defined parent worksheet. Perhaps a wrapping With ... End With statement could be used to specify parentage.