Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
Gafish
Pierre ANDRIEU wrote:
Bonjour,
Bonjour
Existe -t-til l'équivalent de la fonction LPAD (SQL) en Access ? Merci
A mon avis non, il faut que tu la développes, mais c'est relativement simple. Tu fais une boucle où tu ajoutes un ou plusieurs caractères jusqu'à atteindre la taille souhaitée.
Arnaud -- Charte du forum : http://www.mpfa.info/ Recherche dans les archives : http://groups.google.fr/group/microsoft.public.fr.access?hl=fr
Pierre ANDRIEU wrote:
Bonjour,
Bonjour
Existe -t-til l'équivalent de la fonction LPAD (SQL) en Access ?
Merci
A mon avis non, il faut que tu la développes, mais c'est relativement
simple.
Tu fais une boucle où tu ajoutes un ou plusieurs caractères jusqu'à
atteindre la taille souhaitée.
Arnaud
--
Charte du forum : http://www.mpfa.info/
Recherche dans les archives :
http://groups.google.fr/group/microsoft.public.fr.access?hl=fr
Existe -t-til l'équivalent de la fonction LPAD (SQL) en Access ? Merci
A mon avis non, il faut que tu la développes, mais c'est relativement simple. Tu fais une boucle où tu ajoutes un ou plusieurs caractères jusqu'à atteindre la taille souhaitée.
Arnaud -- Charte du forum : http://www.mpfa.info/ Recherche dans les archives : http://groups.google.fr/group/microsoft.public.fr.access?hl=fr
Eric
Bonjour,
Je ne crois pas. Sans boucle, une petite fonction comme cela :
Function fnCadrage(UneChaine As String, _ NbCar As Byte, _ Optional TypeCar As String = "*") As String Dim strCadre As String strCadre = String(NbCar, TypeCar) RSet strCadre = UneChaine fnCadrage = Replace(strCadre, Chr(32), TypeCar) End Function
Bonjour,
Existe -t-til l'équivalent de la fonction LPAD (SQL) en Access ? Merci
Cordialement, Pierre
-- A+ Eric http://www.mpfa.info/ Archives : http://groups.google.fr/group/microsoft.public.fr.access?hl=fr
Bonjour,
Je ne crois pas.
Sans boucle, une petite fonction comme cela :
Function fnCadrage(UneChaine As String, _
NbCar As Byte, _
Optional TypeCar As String = "*") As String
Dim strCadre As String
strCadre = String(NbCar, TypeCar)
RSet strCadre = UneChaine
fnCadrage = Replace(strCadre, Chr(32), TypeCar)
End Function
Bonjour,
Existe -t-til l'équivalent de la fonction LPAD (SQL) en Access ?
Merci
Cordialement,
Pierre
--
A+
Eric
http://www.mpfa.info/
Archives : http://groups.google.fr/group/microsoft.public.fr.access?hl=fr
Je ne crois pas. Sans boucle, une petite fonction comme cela :
Function fnCadrage(UneChaine As String, _ NbCar As Byte, _ Optional TypeCar As String = "*") As String Dim strCadre As String strCadre = String(NbCar, TypeCar) RSet strCadre = UneChaine fnCadrage = Replace(strCadre, Chr(32), TypeCar) End Function
Bonjour,
Existe -t-til l'équivalent de la fonction LPAD (SQL) en Access ? Merci
Cordialement, Pierre
-- A+ Eric http://www.mpfa.info/ Archives : http://groups.google.fr/group/microsoft.public.fr.access?hl=fr
Eric
.../... ou plus simplement:
Function fnCadrage(UneChaine As String, _ NbCar As Byte, _ Optional TypeCar As String = "*") As String fnCadrage = Replace(Format(UneChaine, String(NbCar, "@")), _ Chr(32), TypeCar) End Function
? fncadrage("toto",10) retournera : ******toto
-- A+ Eric http://www.mpfa.info/ Archives : http://groups.google.fr/group/microsoft.public.fr.access?hl=fr
.../...
ou plus simplement:
Function fnCadrage(UneChaine As String, _
NbCar As Byte, _
Optional TypeCar As String = "*") As String
fnCadrage = Replace(Format(UneChaine, String(NbCar, "@")), _
Chr(32), TypeCar)
End Function
? fncadrage("toto",10) retournera : ******toto
--
A+
Eric
http://www.mpfa.info/
Archives : http://groups.google.fr/group/microsoft.public.fr.access?hl=fr
Function fnCadrage(UneChaine As String, _ NbCar As Byte, _ Optional TypeCar As String = "*") As String fnCadrage = Replace(Format(UneChaine, String(NbCar, "@")), _ Chr(32), TypeCar) End Function
? fncadrage("toto",10) retournera : ******toto
-- A+ Eric http://www.mpfa.info/ Archives : http://groups.google.fr/group/microsoft.public.fr.access?hl=fr
Pierre ANDRIEU
Merci à vous pour vos réponses... mais replace() n'existe pas dans access 97 (désolé j'avais pas précisé)...
Une solution possible:
Dim x As Integer Dim PadLength As Integer
Function LPAD(MyValue$, MyPadCharacter$, MyPaddedLength%)
PadLength = MyPaddedLength - Len(MyValue) Dim PadString As String For x = 1 To PadLength PadString = PadString & MyPadCharacter Next LPAD = PadString + MyValue
End Function
-- Cordialement
Pierre ANDRIEU
..../... ou plus simplement:
Function fnCadrage(UneChaine As String, _ NbCar As Byte, _ Optional TypeCar As String = "*") As String fnCadrage = Replace(Format(UneChaine, String(NbCar, "@")), _ Chr(32), TypeCar) End Function
? fncadrage("toto",10) retournera : ******toto
-- A+ Eric http://www.mpfa.info/ Archives : http://groups.google.fr/group/microsoft.public.fr.access?hl=fr
Merci à vous pour vos réponses... mais replace() n'existe pas dans access 97
(désolé j'avais pas précisé)...
Une solution possible:
Dim x As Integer
Dim PadLength As Integer
Function LPAD(MyValue$, MyPadCharacter$, MyPaddedLength%)
PadLength = MyPaddedLength - Len(MyValue)
Dim PadString As String
For x = 1 To PadLength
PadString = PadString & MyPadCharacter
Next
LPAD = PadString + MyValue
End Function
--
Cordialement
Pierre ANDRIEU
..../...
ou plus simplement:
Function fnCadrage(UneChaine As String, _
NbCar As Byte, _
Optional TypeCar As String = "*") As String
fnCadrage = Replace(Format(UneChaine, String(NbCar, "@")), _
Chr(32), TypeCar)
End Function
? fncadrage("toto",10) retournera : ******toto
--
A+
Eric
http://www.mpfa.info/
Archives : http://groups.google.fr/group/microsoft.public.fr.access?hl=fr
Merci à vous pour vos réponses... mais replace() n'existe pas dans access 97 (désolé j'avais pas précisé)...
Une solution possible:
Dim x As Integer Dim PadLength As Integer
Function LPAD(MyValue$, MyPadCharacter$, MyPaddedLength%)
PadLength = MyPaddedLength - Len(MyValue) Dim PadString As String For x = 1 To PadLength PadString = PadString & MyPadCharacter Next LPAD = PadString + MyValue
End Function
-- Cordialement
Pierre ANDRIEU
..../... ou plus simplement:
Function fnCadrage(UneChaine As String, _ NbCar As Byte, _ Optional TypeCar As String = "*") As String fnCadrage = Replace(Format(UneChaine, String(NbCar, "@")), _ Chr(32), TypeCar) End Function
? fncadrage("toto",10) retournera : ******toto
-- A+ Eric http://www.mpfa.info/ Archives : http://groups.google.fr/group/microsoft.public.fr.access?hl=fr
Gafish
Pierre ANDRIEU wrote:
Merci à vous pour vos réponses... mais replace() n'existe pas dans access 97 (désolé j'avais pas précisé)...
Pour replace sous 97, tu peux copier coller cette fonction dans un module standard : http://access.jessy.free.fr/htm/Equivalence/fReplace.htm
Arnaud -- Charte du forum : http://www.mpfa.info/ Recherche dans les archives : http://groups.google.fr/group/microsoft.public.fr.access?hl=fr
Pierre ANDRIEU wrote:
Merci à vous pour vos réponses... mais replace() n'existe pas dans
access 97 (désolé j'avais pas précisé)...
Pour replace sous 97, tu peux copier coller cette fonction dans un module
standard :
http://access.jessy.free.fr/htm/Equivalence/fReplace.htm
Arnaud
--
Charte du forum : http://www.mpfa.info/
Recherche dans les archives :
http://groups.google.fr/group/microsoft.public.fr.access?hl=fr