cs_lhomme
Messages postés27Date d'inscriptionlundi 7 juin 2004StatutMembreDernière intervention21 juillet 2004
-
14 juil. 2004 à 17:01
cs_ITALIA
Messages postés2169Date d'inscriptionvendredi 20 avril 2001StatutMembreDernière intervention30 juin 2009
-
15 juil. 2004 à 09:14
J ai une fonction qui pioche des chiffres ( qui ont des valeurs decimales) ds un fichier excel
met le probleme c est les donnees ecrites ne sont plus avec des chiffres apres la virgule!!
Mais pkoi donc ?
voici mon code :
Private Sub Cmd_Importation_Click()
' all the var. we need ( string, integer, recordset, database )
Dim PathFic As String
Dim NomFic As String
Dim NomFicXLS As String
Dim iInventarnr As String
Dim iRestBuchWert As Single
Dim i As Integer
Dim j As Integer
Dim sql1 As String
Dim dbs As database
Dim rs As Recordset
Dim process As Variant
Dim count As Integer
Dim numInv
'initialization of the objects we use
Set dbs = CurrentDb
Set ClasseurXLS = CreateObject("Excel.application")
'Initialization : ask the name of the file
If (Text1.value <> "") Then
NomFic = Text1
NomFic = "" & NomFic
Else
MsgBox ("The name of the file 1 is missing")
Forms!Update![Text1].SetFocus
Exit Sub
End If
'Initialization : ask the way to obtain the file
If (Text3.value <> "") Then
PathFic = Text3
Else
MsgBox ("The name of the folder 1 is missing")
Forms!Update![Text3].SetFocus
Exit Sub
End If
On Error GoTo Err:
ClasseurXLS.Workbooks.Open PathFic & NomFic
i = 2
Do While ClasseurXLS.Cells(i, 1) <> ""
iInventarnr = ClasseurXLS.Cells(i, 1)
iRestBuchWert = ClasseurXLS.Cells(i, 2) sql1 "SELECT * FROM Maintable Where Maintable.InventarNr '" & iInventarnr & "'"
Set rs = dbs.OpenRecordset(sql1, dbOpenDynaset)
count = rs.RecordCount
If count <> 0 Then
Do While Not rs.EOF
rs.Edit
If Not IsNull(iRestBuchWert) Then
rs.Fields("Restbuchwert") = iRestBuchWert
rs.Update
End If