Hallo,
ich möchte ein Programm entwickeln, dass es mir einfach die Informationen des Barcodes (Artikelnummer) auf dem Bildschirm ausgibt.
In der Maske soll man immer genau 12 Barcodes scannen.
Ich habe da was geschrieben, aber es funktioniert nicht, bzw. wenn ich den Barcode einscanne, dann passiert nix.
Evtl. kann man das auch ganz einfacher programmieren, habe da noch nicht die richtige "reife"...
Vielen Dank im Voraus. Der Code ist folgender:
Option Explicit
Dim wCount As Integer
Dim wCHeight As Double
Dim wCountScan As Integer
Dim wContON() As Double
Dim wContSN() As Double
Dim wPos As Integer
Dim wContNR As Double
Dim wCpCont As Boolean
Dim wUser As Double
Private Sub FwOr_Insfield(Index As Integer, Colonna As Integer, Testo As _
String, width As Integer)
End Sub
Private Sub ILoadFW()
With FwOr(0)
.ConnessioneADO = CnPbl
.Tabella = "PBL_Access"
.CampoText1 "ACPassword", numerico, True
.CampoText2 "ACSurname", Stringa, False
End Sub
Private Sub LoadForm()
Dim i As Integer
On Error GoTo err
For i = 1 To wCount
LOAD FwTxtP(i)
FwTxtP(i).Top = FwTxtP(i - 1).Top + 10 + FwTxtP(i).Height
FwTxtP(i).Visible = True
LOAD Fwtxt(i)
Fwtxt(i).Top = Fwtxt(i - 1).Top + 10 + Fwtxt(i).Height
Fwtxt(i).Visible = True
Next i
wCountScan = 1
Exit Sub
err:
Unload Me
End Sub
Private Sub FwOr_ValCampiAgg(Index As Integer, Name As String, Valore As String)
If Name = "ACCode" Then
wUser = Valore
End If
End Sub
Private Sub Form_Load()
CmbShift.AddItem "1 | 06:00-14:00"
CmbShift.AddItem "2 | 14:00-22:00"
CmbShift.AddItem "3 | 22:00-06:00"
CmbShift.AddItem "4 | 07:00-16:30"
CmbShift.ListIndex = 3
With Me
.Caption = "Check Sequence"
.width = 15500
.Height = 10050
.WindowState = 2
End With
ILoadFW
ReDim wContON(wCount)
ReDim wContSN(wCount)
LoadScanner
If wCpCont = True Then
If wCount <> 0 Then
Text1.Text = wCount
End If
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
err.Clear
On Error GoTo err
If MSComm1.PortOpen = True Then MSComm1.PortOpen = False
Exit Sub
err:
MsgBox err.Number & " " & err.Description, vbCritical, "EDI STATION"
End Sub
Private Sub LoadScanner()
Dim wComm As Integer
Dim wCompName As String
err.Clear
On Error GoTo err
wCompName = GetCompName
sqlcmd = "select CPComComm as XXX from PBL_ClientParam" & _
" where CPCompName ='" & wCompName & "'"
If RS.State = 1 Then RS.Close
RS.Open sqlcmd, CnPbl
wComm = IIf(IsNull(RS!xxx) = True, 1, RS!xxx)
If MSComm1.PortOpen = True Then MSComm1.PortOpen = False
With MSComm1
.CommPort = wComm
.Settings = "9600,N,8,1"
.RThreshold = 1
.EOFEnable = True
.InputMode = comInputModeText
.PortOpen = True
End With
Exit Sub
err:
MsgBox err.Number & " " & err.Description, vbCritical, "EDI STATION"
End Sub
Private Sub MSComm1_OnComm()
Dim wTempScan As String
Dim wChkCon As Boolean
Dim wChkRes As Boolean
err.Clear
On Error GoTo Errs
wChkCon = False
wChkRes = False
If Trim(FwOr(0).ctltext1) = "" Or Trim(FwOr(0).ctltext2) = "" Then
MsgBox "PLEASE TYPE OPERATOR PASSWORD", vbCritical, "EDI STATION"
Exit Sub
End If
wTempScan = MSComm1.Input
If wTempScan = "" Then Exit Sub
wPos = 12
Fwtxt(wCountScan) = Mid(Trim(wTempScan), 1, 7)
Fwtxt(wCountScan).Enabled = False
If wCountScan = 13 Then
MsgBox "Container is full", vbInformation, "Edi Station"
End If
Exit Sub
Errs:
If err.Number = 13 Then
MsgBox "Wrong Value Entered", vbCritical, "Edi Station"
Else
MsgBox err.Number & " " & err.Description
End If
End Sub
Private Sub ManualInput(xObject As Object, Optional Index As Integer)
Dim wTempScan As String
Dim wChkCon As Boolean
Dim wChkRes As Boolean
err.Clear
On Error GoTo Errs
wChkCon = False
wChkRes = False
If Trim(FwOr(0).ctltext1) = "" Or Trim(FwOr(0).ctltext2) = "" Then
MsgBox "PLEASE TYPE OPERATOR PASSWORD", vbCritical, "EDI STATION"
Exit Sub
End If
wTempScan = xObject
If wTempScan = "" Then Exit Sub
wPos = 12
FwTxtP(wCountScan) = Mid(Trim(wTempScan), 1, 7)
Fwtxt(wCountScan) = Mid(Trim(wTempScan), 1, 7)
Fwtxt(wCountScan).Enabled = False
If wCountScan = 13 Then
MsgBox "Container is full", vbInformation, "Edi Station"
End If
Exit Sub |