>SELECT CAST(SUM(NewAccount) AS INT) AS SumColumn FROM Monthly >or >SELECT CONVERT(INT, SUM(NewAccount)) AS SumColumn FROM Monthly >>It may be that the server is creating a column of a different data type.
If Not loDataProviderTotal.SQLExec("SELECT SUM(" + aField(lnCounter, 1) + _ ") AS SumColumn FROM " + cAlias, cConnectionString) Then cHtml = oApp.cError Return False End If loRowTotal = loDataProviderTotal.oDataView(0).Row MessageBox.Show(oApp.GetFormatValue(loRowTotal("SumColumn") , 2))
' Format a value ' expC1 Separator ' expN2 Number of decimals Public Function GetFormat(ByVal tcSeparator As String, ByVal tnDecimal As Integer) As String Dim lcFormat As String = "" Dim lnCounter As Integer = 0 ' Obtain formatted value lcFormat = "" For lnCounter = 1 To 9 lcFormat = "#" + lcFormat If lnCounter Mod 3 = 0 Then lcFormat = tcSeparator + lcFormat End If Next lcFormat = lcFormat + "0" ' If we have decimals If tnDecimal > 0 Then lcFormat = lcFormat + "." + "".PadRight(tnDecimal, "0") End If Return lcFormat End Function ' Format a value ' expN1 Value ' expC1 Separator ' expN2 Number of decimals Public Function GetFormatValue(ByVal tnValue As Double, ByVal tcSeparator As String, _ ByVal tnDecimal As Integer) As String Dim lcFormat As String = "" Dim lcValue As String = "" lcFormat = oApp.GetFormat(tcSeparator, tnDecimal) lcValue = Format(tnValue, lcFormat) Return lcValue End Function