Using the following code I have a questions. .Fields(intFldCntr) = 2.66666666666667 yet after loading it into arrWhite(intIndex), arrWhite(intIndex) = 3. I'm working to get some weighted averages so I want the actual number. How can I prevent it from being rounded when I load it into the array?
Thanks.

Dim arrWhite(rs.Fields.Count - 1) As Integer

intIndex = 0
Dim intTemp As Integer
With rs
For intFldCntr = 1 To .Fields.Count - 1
arrWhite(intIndex) = .Fields(intFldCntr)
intIndex = intIndex + 1
Next
End With

Use the format function to set it to say two decimal places -

arrWhite(intIndex) = Format(.Fields(intFldCntr), "####.00")

The code I supplied above will however return a zero decimal value if you have declared intFldCntr as an Integer. Rather declare it as a Double, works fine. See below -

Dim x As Double

x = 1234.987654

Text1.Text = Format(x, "Fixed")

Replace first line with

Dim arrWhite(rs.Fields.Count - 1) As Double
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.