Re: number field comes in as integer



Clayman wrote:
Using Excel 2000 VBA and ADODB:

LVacRate is declared (Option Explicit) as Long. It is populated from
an Access database via ADODB using the following code:

Dim LVacRate As Long

sSQL = "SELECT [LastName], [FirstName], [HireDate], [VacRate] " & _
"FROM EmpData, CurrentData " & _
"WHERE EmpData.[FileNum] = '" & StrFileNum & "' AND
CurrentData.[FileNum] = '" & _
StrFileNum & "';"

Set VacRS = VacConn.Execute(sSQL)
If Not VacRS.EOF Then
StrFirstName = VacRS![firstname]
StrLastName = VacRS![LastName]
DtHireDate = VacRS![hiredate]
LVacRate = VacRS![VacRate]

In the database, VacRS![VacRate] is a Number containing 19.85. After
executing the code, LVacRate = 20. Using the Watch Window, I have
verified that LVacRate is, indeed, long, and VacRS![VacRate] does
contain 19.85.

Where am I going wrong?

I don't know. What do you think is the problem?

Are you expecting a Long to retain the decimal portion? A Long datatype is
an integer. if you want to retain the decimal, you have to declare the
variable as either a Single or a Double.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


.