ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   eof (https://www.excelbanter.com/excel-programming/327557-eof.html)

mk

eof
 
Hi
I'm opening txt file where I have information abaut products
Already I have:

Private Sub PLServer1_DataArrived(ByVal id As Long, ByVal frameid As
Integer)
Dim retval As Boolean
Dim odczyt, odczyt2, odczyt3, odczyt4, odczyt5, odczyt6, odczyt7, kod As
String
code = PLServer1.GetData(id, 46)
Open "c:\test.txt" For Input As #1
pozycja:
Input #1, odczyt, odczyt2, odczyt3, odczyt4, odczyt5, odczyt6, odczyt7, kod
If EOF(1) = True Then
GoTo niema
ElseIf kod < code Then
GoTo pozycja
Else
Label1.Caption = odczyt
Label2.Caption = odczyt2
Label3.Caption = kod
Close
retval = PLServer1.Text(id, 40, odczyt2)
retval = PLServer1.Send(id, -1)
End If
niema:
retval = PLServer1.Text(id, 1, "ERROR")
End Sub

___________________
"code" is barcode value from hand terminal, "kod" is barcode field from
txt file
"retval" is sending information to terminal (In thise case value field
"odczyt2" from txt file)

Every thing is ok when "code" value exist in txt file, but I want to
sent to terminal information "ERROR" if "code" value not exist in txt
file (like in "niema:"). How I can do it?
thanks for any help.
mk

keepITcool

eof
 
normally:

Open strFile For Input As #1
While Not EOF(1)
Input #1, myVar
Wend
'or
Do While Not EOF(1)
Input #1, myVar
Loop

Close


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


mk wrote :

Hi
I'm opening txt file where I have information abaut products
Already I have:

Private Sub PLServer1_DataArrived(ByVal id As Long, ByVal frameid As
Integer) Dim retval As Boolean
Dim odczyt, odczyt2, odczyt3, odczyt4, odczyt5, odczyt6, odczyt7, kod
As String code = PLServer1.GetData(id, 46)
Open "c:\test.txt" For Input As #1
pozycja:
Input #1, odczyt, odczyt2, odczyt3, odczyt4, odczyt5, odczyt6,
odczyt7, kod If EOF(1) = True Then
GoTo niema
ElseIf kod < code Then
GoTo pozycja
Else
Label1.Caption = odczyt
Label2.Caption = odczyt2
Label3.Caption = kod
Close
retval = PLServer1.Text(id, 40, odczyt2)
retval = PLServer1.Send(id, -1)
End If
niema:
retval = PLServer1.Text(id, 1, "ERROR")
End Sub

___________________
"code" is barcode value from hand terminal, "kod" is barcode field
from txt file "retval" is sending information to terminal (In thise
case value field "odczyt2" from txt file)

Every thing is ok when "code" value exist in txt file, but I want to
sent to terminal information "ERROR" if "code" value not exist in txt
file (like in "niema:"). How I can do it? thanks for any help. mk



All times are GMT +1. The time now is 08:39 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com