excel to access problems




I've created an Excel worksheet that has been configured to updated
records of an access database. The records have a mixture of strings
and numbers. All the numbers in the database have been configured with
the REAL data type.

The problem I'm having is with the numbers e.g. I've added a record
with one of the fields having a value of say 4.2. When I retrieve the
record back into Excel it comes back as 4.199283734675 why is? Could it
be a problem with my programming and the way I add a record?

Below is the part of the SQL statement that adds the value. The
function fGetCellFormat checks the format of the cell so that the wrap
character is correct.

strSQL = strSQL & " VALUES ("

For intCount = 1 To ctiDataField
Select Case fGetCellFormat(.Range(ctsNcRecipe &
Case "TEXT"
strWrapChar = """"
strWrapChar = "#"
Case Else
strWrapChar = ""
End Select

strSQL = strSQL & strWrapChar & .Range(ctsNcRecipe &
intCount).Value & strWrapChar

If intCount <> ctiDataField Then
strSQL = strSQL & ", "
strSQL = strSQL & ")"
End If

I'm still quite new to programming so any help or ideas would be

Thanks in advance



I would guess that the cell really contains 4.199283734675 and the cell is
formatted to show only 1 decimal place, so appears as 4.2, but the underlying
value is what is transferred.

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question