ERRO FORMULA

ERLANMG 01/02/2013 15:04:04
#418579
Caros colegas,

Uso vb e crystal report 9.2 em um sistema para emissão do CT-e. Mas em alguns DACTE (documento auxiliar do conhecimento de transporte eletronico), ocorre o seguinte erro the remaining text does not appear to be part of the formula (o texto restante não parece ser parte da fórmula)

Este erro ocorre por causa do código de barras.

Uso uma função para gerar os caracteres do código de barras e uso uma fonte para exibir.

Alguém sabe como corrigir este erro.

Desde já agradeço a todos.



ERLANMG 01/02/2013 16:03:21
#418588
Alguém?????
MARCELO.TREZE 01/02/2013 16:06:10
#418589
Resposta escolhida
posta os códigos colega
ERLANMG 01/02/2013 16:30:19
#418595
Marcelo Treze, segue os códigos:

No form passo parametro para o crystal atraves de formula:

If CRXFormulaField.Name = [Ô]{@CODIGO_BARRAS}[Ô] Then
CRXFormulaField.Text = [Ô][ô][Ô] & code128$(ChaveAcesso) & [Ô][ô][Ô]
End If

No modulo:

Public Function code128$(chaine$)
Dim i%, checksum&, mini%, dummy%, tableB As Boolean
code128$ = [Ô][Ô]
If Len(chaine$) > 0 Then
[ô]Vérifier si caractères valides
[ô]Check for valid characters
For i% = 1 To Len(chaine$)
Select Case Asc(Mid$(chaine$, i%, 1))
Case 32 To 126, 203
Case Else
i% = 0
Exit For
End Select
Next
[ô]Calculer la chaine de code en optimisant l[ô]usage des tables B et C
[ô]Calculation of the code string with optimized use of tables B and C
code128$ = [Ô][Ô]
tableB = True
If i% > 0 Then
i% = 1 [ô]i% devient l[ô]index sur la chaine / i% become the string index
Do While i% <= Len(chaine$)
If tableB Then
[ô]Voir si intéressant de passer en table C / See if interesting to switch to table C
[ô]Oui pour 4 chiffres au début ou à la fin, sinon pour 6 chiffres / yes for 4 digits at start or end, else if 6 digits
mini% = IIf(i% = 1 Or i% + 3 = Len(chaine$), 4, 6)
GoSub testnum
If mini% < 0 Then [ô]Choix table C / Choice of table C
If i% = 1 Then [ô]Débuter sur table C / Starting with table C
code128$ = Chr$(210)
Else [ô]Commuter sur table C / Switch to table C
code128$ = code128$ & Chr$(204)
End If
tableB = False
Else
If i% = 1 Then code128$ = Chr$(209) [ô]Débuter sur table B / Starting with table B
End If
End If
If Not tableB Then
[ô]On est sur la table C, essayer de traiter 2 chiffres / We are on table C, try to process 2 digits
mini% = 2
GoSub testnum
If mini% < 0 Then [ô]OK pour 2 chiffres, les traiter / OK for 2 digits, process it
dummy% = Val(Mid$(chaine$, i%, 2))
dummy% = IIf(dummy% < 95, dummy% + 32, dummy% + 105)
code128$ = code128$ & Chr$(dummy%)
i% = i% + 2
Else [ô]On n[ô]a pas 2 chiffres, repasser en table B / We haven[ô]t 2 digits, switch to table B
code128$ = code128$ & Chr$(205)
tableB = True
End If
End If
If tableB Then
[ô]Traiter 1 caractère en table B / Process 1 digit with table B
code128$ = code128$ & Mid$(chaine$, i%, 1)
i% = i% + 1
End If
Loop
[ô]Calcul de la clé de contrôle / Calculation of the checksum
For i% = 1 To Len(code128$)
dummy% = Asc(Mid$(code128$, i%, 1))
dummy% = IIf(dummy% < 127, dummy% - 32, dummy% - 105)
If i% = 1 Then checksum& = dummy%
checksum& = (checksum& + (i% - 1) * dummy%) Mod 103
Next
[ô]Calcul du code ASCII de la clé / Calculation of the checksum ASCII code
checksum& = IIf(checksum& < 95, checksum& + 32, checksum& + 105)
[ô]Ajout de la clé et du STOP / Add the checksum and the STOP
code128$ = code128$ & Chr$(checksum&) & Chr$(211)
End If
End If
Exit Function
testnum:
[ô]si les mini% caractères à partir de i% sont numériques, alors mini%=0
[ô]if the mini% characters from i% are numeric, then mini%=0
mini% = mini% - 1
If i% + mini% <= Len(chaine$) Then
Do While mini% >= 0
If Asc(Mid$(chaine$, i% + mini%, 1)) < 48 Or Asc(Mid$(chaine$, i% + mini%, 1)) > 57 Then Exit Do
mini% = mini% - 1
Loop
End If
Return
End Function
ERLANMG 01/02/2013 23:17:10
#418623
Alguém. por favor?????
MARCELO.TREZE 01/02/2013 23:37:41
#418624
em que linha o erro aponta
MARCELO.TREZE 01/02/2013 23:43:06
#418625
da uma lida talvez voce encontre o problema

http://www.idautomation.com/kb/crystal-remaining-text-formula.html
Tópico encerrado , respostas não são mais permitidas