Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default excel to access problems


Hi,

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 &
intCount).Value)
Case "TEXT"
strWrapChar = """"
Case "DATETIME"
strWrapChar = "#"
Case Else
strWrapChar = ""
End Select

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

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


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

Thanks in advance

Rich

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default excel to access problems

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.

--
Regards,
Tom Ogilvy


"rich" wrote:


Hi,

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 &
intCount).Value)
Case "TEXT"
strWrapChar = """"
Case "DATETIME"
strWrapChar = "#"
Case Else
strWrapChar = ""
End Select

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

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


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

Thanks in advance

Rich


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel worksheets access & other problems tom Excel Discussion (Misc queries) 0 July 25th 06 06:49 PM
Excel & Access Import Problems Mr-Re Man Excel Discussion (Misc queries) 0 May 3rd 06 11:35 AM
ACCESS to EXCEL problems robert111 Excel Discussion (Misc queries) 0 April 27th 06 04:48 PM
Problems using MS Query to access an Excel file alfredo Excel Programming 3 February 13th 06 12:30 AM
Problems opening Access database from Excel VBA Jan[_11_] Excel Programming 3 June 2nd 04 12:08 PM


All times are GMT +1. The time now is 04:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"