1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
| Function Barcode39_CordeGrappe(anycode, startx, starty, depth, nbar, wbar, ibar)
Dim dbBaseDonnees As Database, TableBarcode39 As Recordset
Dim newposn As Single
' all for bar dimensions
Dim countx, CptCaracteres, countr As Single ' loop counters
Dim getstr, extstr As Variant ' value to encode,
' and value plus
' stop/start chars
Dim Codage, onechr As String ' value of Bar39 Pattern field
Dim Couleur As Long ' alternates Couleur of bars
Dim Etat As Report
Dim CritereTableBarcode39 As String
Set dbBaseDonnees = DBEngine.Workspaces(0).Databases(0)
Set TableBarcode39 = dbBaseDonnees.OpenRecordset("Barcode39", DB_OPEN_DYNASET)
'Set Etat = Screen.ActiveReport
Set Etat = Reports("et_CordeGrappe")
newposn = startx
Couleur = 16777215 ' set to white initially
getstr = anycode
extstr = "*" & getstr & "*" ' add stop/start character (*)
For countx = 1 To Len(extstr)
CritereTableBarcode39 = "Character = '" & Mid$(extstr, countx, 1) + "'"
TableBarcode39.FindFirst CritereTableBarcode39
If TableBarcode39.NoMatch Then ' can't find a character -
' show red 'error' box
' on Preview, but continue
MsgBox ("Field contains a character not supported by 3 of 9")
Etat.Line (startx, starty)-Step(depth, depth), 255, BF
Else
Codage = TableBarcode39![Pattern]
For CptCaracteres = 1 To 10
onechr = Mid$(Codage, CptCaracteres, 1)
If Couleur = 16777215 Then
'Couleur = 16771680
Couleur = 0
Else
Couleur = 16777215
End If
Select Case onechr
Case "L"
Etat.Line (newposn, starty)-Step(wbar, depth), Couleur, BF
newposn = newposn + wbar ' reposition start point
Case "S"
Etat.Line (newposn, starty)-Step(nbar, depth), Couleur, BF
newposn = newposn + nbar ' reposition start point
Case "I"
Etat.Line (newposn, starty)-Step(ibar, depth), Couleur, BF
newposn = newposn + ibar ' reposition start point
Case Else 'Ne doit jamais arriver mais...
MsgBox ("An invalid code has been entered in the Bar39 Table")
' show blue 'error' box, but
' continue
Etat.Line (startx, starty)-Step(depth, depth), 8388608, BF
End Select
Next CptCaracteres ' end pattern string loop
End If ' end character check
Next countx ' end character loop
TableBarcode39.Close ' close lookup table
End Function |
Partager