Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Resultat de Calcul - Text box

4 réponses
Avatar
A COSTA
Bonjour,
Dans un formulaire j'ai 3 TextBox - "Prix", "Qte" et "Total"
Apres introduction du prix et de la quantité, j'ai bien le total mais si par
exemple la Qte est 0,75, 0,50 ou 0,25 je n'ai pas le résultat correct.
Si le prix est 100 et dans la Qte je mets 75% j'ai un total de 100; si la
Qte est 50% ou 25% le Total devient zéro.

J'ai ça:

Private Sub Qte_Change()
Calcul
End Sub

Sub Calcul()
If Me.Prix <> "" And Me.Qte <> "" Then
Me.Total = Format(CDbl(Me.Prix) * CInt(Me.Qte), "0.00 €")
End If
End Sub


Pourriez vous m'aider, s.v.p. ?
Merci d'avance
A. Costa

4 réponses

Avatar
Corto
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type" >
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<pre wrap="">Bonjour A COSTA,
dans la ligne :
Me.Total = Format(CDbl(Me.Prix) * <font color="red"><b>CInt</b>(</ font>Me.Qte), "0.00 €")
CInt convertit Me.Qte en integer.
Me.Total = Format(CDbl(Me.Prix) * <font color="red"><b>CDbl</b>(</ font>Me.Qte), "0.00 €")
devrait marcher.

Corto
</pre>
<br>
A COSTA a écrit :
<blockquote
cite="mid:"
type="cite">
<pre wrap="">Bonjour,
Dans un formulaire j'ai 3 TextBox - "Prix", "Qte" et "Total"
Apres introduction du prix et de la quantité, j'ai bien le total mai s si par
exemple la Qte est 0,75, 0,50 ou 0,25 je n'ai pas le résultat correc t.
Si le prix est 100 et dans la Qte je mets 75% j'ai un total de 100; si la
Qte est 50% ou 25% le Total devient zéro.

J'ai ça:

Private Sub Qte_Change()
Calcul
End Sub

Sub Calcul()
If Me.Prix &lt;&gt; "" And Me.Qte &lt;&gt; "" Then
Me.Total = Format(CDbl(Me.Prix) * CInt(Me.Qte), "0.00 €")
End If
End Sub


Pourriez vous m'aider, s.v.p. ?
Merci d'avance
A. Costa

</pre>
</blockquote>
</body>
</html>
Avatar
A COSTA
Re-bonjour,
Si j'utilise:
Me.Total = Format(CDbl(Me.Prix) * fontcolor = "red" <> b > CDbl(Font >
Me.Qte), "0.00 €")

le résultat est toujours -1
Merci


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<pre wrap="">Bonjour A COSTA,
dans la ligne :
Me.Total = Format(CDbl(Me.Prix) * <font color="red"><b>CInt</b>(</font>Me.Qte), "0.00 €")
CInt convertit Me.Qte en integer.
Me.Total = Format(CDbl(Me.Prix) * <font color="red"><b>CDbl</b>(</font>Me.Qte), "0.00 €")
devrait marcher.

Corto
</pre>
<br>
<blockquote
cite="mid:"
type="cite">
<pre wrap="">Bonjour,
Dans un formulaire j'ai 3 TextBox - "Prix", "Qte" et "Total"
Apres introduction du prix et de la quantité, j'ai bien le total mais si par
exemple la Qte est 0,75, 0,50 ou 0,25 je n'ai pas le résultat correct.
Si le prix est 100 et dans la Qte je mets 75% j'ai un total de 100; si la
Qte est 50% ou 25% le Total devient zéro.

J'ai ça:

Private Sub Qte_Change()
Calcul
End Sub

Sub Calcul()
If Me.Prix <> "" And Me.Qte <> "" Then
Me.Total = Format(CDbl(Me.Prix) * CInt(Me.Qte), "0.00 €")
End If
End Sub


Pourriez vous m'aider, s.v.p. ?
Merci d'avance
A. Costa

</pre>
</blockquote>
</body>
</html>



Avatar
Corto
Bonjour A COSTA,

J'ai testé la macro suivante chez moi et ca marche, quand j'entre 10 0
dans prix et 0,75 dans qte il m'affiche bien 75,00 € dans total.
Private Sub Qte_Change()
If Me.Prix <> "" And Me.Qte <> "" Then
Me.Total = Format(CDbl(Me.Prix) * CDbl(Me.Qte), "0.00 €")
End If
End Sub

Corto

Re-bonjour,
Si j'utilise:
Me.Total = Format(CDbl(Me.Prix) * fontcolor = "red" <> b > CDbl (Font >
Me.Qte), "0.00 €")

le résultat est toujours -1
Merci



<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Ty pe">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<pre wrap="">Bonjour A COSTA,
dans la ligne :
Me.Total = Format(CDbl(Me.Prix) * <font color="red"><b>CInt</b> (</font>Me.Qte), "0.00 €")
CInt convertit Me.Qte en integer.
Me.Total = Format(CDbl(Me.Prix) * <font color="red"><b>CDbl</b> (</font>Me.Qte), "0.00 €")
devrait marcher.

Corto
</pre>
<br>
<blockquote
cite="mid:"
type="cite">
<pre wrap="">Bonjour,
Dans un formulaire j'ai 3 TextBox - "Prix", "Qte" et "Total"
Apres introduction du prix et de la quantité, j'ai bien le total mais si par
exemple la Qte est 0,75, 0,50 ou 0,25 je n'ai pas le résultat cor rect.
Si le prix est 100 et dans la Qte je mets 75% j'ai un total de 100; si la
Qte est 50% ou 25% le Total devient zéro.

J'ai ça:

Private Sub Qte_Change()
Calcul
End Sub

Sub Calcul()
If Me.Prix <> "" And Me.Qte <> "" Then
Me.Total = Format(CDbl(Me.Prix) * CInt(Me.Qte), "0.00 €")
End If
End Sub


Pourriez vous m'aider, s.v.p. ?
Merci d'avance
A. Costa

</pre>
</blockquote>
</body>
</html>






Avatar
A COSTA
Merci encore une fois
ça marche
Bonne journée
A. Costa


Bonjour A COSTA,

J'ai testé la macro suivante chez moi et ca marche, quand j'entre 100
dans prix et 0,75 dans qte il m'affiche bien 75,00 € dans total.
Private Sub Qte_Change()
If Me.Prix <> "" And Me.Qte <> "" Then
Me.Total = Format(CDbl(Me.Prix) * CDbl(Me.Qte), "0.00 €")
End If
End Sub

Corto

Re-bonjour,
Si j'utilise:
Me.Total = Format(CDbl(Me.Prix) * fontcolor = "red" <> b > CDbl(Font >
Me.Qte), "0.00 €")

le résultat est toujours -1
Merci



<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<pre wrap="">Bonjour A COSTA,
dans la ligne :
Me.Total = Format(CDbl(Me.Prix) * <font color="red"><b>CInt</b>(</font>Me.Qte), "0.00 €")
CInt convertit Me.Qte en integer.
Me.Total = Format(CDbl(Me.Prix) * <font color="red"><b>CDbl</b>(</font>Me.Qte), "0.00 €")
devrait marcher.

Corto
</pre>
<br>
<blockquote
cite="mid:"
type="cite">
<pre wrap="">Bonjour,
Dans un formulaire j'ai 3 TextBox - "Prix", "Qte" et "Total"
Apres introduction du prix et de la quantité, j'ai bien le total mais si par
exemple la Qte est 0,75, 0,50 ou 0,25 je n'ai pas le résultat correct.
Si le prix est 100 et dans la Qte je mets 75% j'ai un total de 100; si la
Qte est 50% ou 25% le Total devient zéro.

J'ai ça:

Private Sub Qte_Change()
Calcul
End Sub

Sub Calcul()
If Me.Prix <> "" And Me.Qte <> "" Then
Me.Total = Format(CDbl(Me.Prix) * CInt(Me.Qte), "0.00 €")
End If
End Sub


Pourriez vous m'aider, s.v.p. ?
Merci d'avance
A. Costa

</pre>
</blockquote>
</body>
</html>