!! garder les chiffres apres la virgule

cs_lhomme Messages postés 27 Date d'inscription lundi 7 juin 2004 Statut Membre Dernière intervention 21 juillet 2004 - 14 juil. 2004 à 17:01
cs_ITALIA Messages postés 2169 Date d'inscription vendredi 20 avril 2001 Statut Membre Dernière intervention 30 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

rs.MoveNext
Loop
End If
i = i + 1
Loop

rs.Close
MsgBox ("RestBuchwert Update OK")
DoCmd.Close acForm, "RestbuchWert"

Exit_Cmd_Importation_Click:
Exit Sub

Err:
MsgBox ("An error has occured. Please verify the foldersŽand filesŽnames")
Exit Sub

End Sub

merci

2 réponses

cs_valer Messages postés 140 Date d'inscription mercredi 26 mai 2004 Statut Membre Dernière intervention 26 juillet 2004
15 juil. 2004 à 08:44
salut,
apparemment tu declares ces chiffres en integer, essais peut etre en long ou double je te promet rien mais c peut etre ca...
Valer
0
cs_ITALIA Messages postés 2169 Date d'inscription vendredi 20 avril 2001 Statut Membre Dernière intervention 30 juin 2009 9
15 juil. 2004 à 09:14
je suis ok avec toi Valer tu declares mal tes types !!

It@li@
0
Rejoignez-nous