Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String formatting

Status
Not open for further replies.

Billybonga

IS-IT--Management
Jun 22, 2002
72
GB
I'm writing a program to handle the scanning of barcodes. I want to include an if statement checking the length of the input string. A valid barcode is either 8 or 13 characters long, anything else is invalid. Can someone help me on this. This is the code I've been trying be it does not work:

If Len(code) <> 8 Or Len(code) <> 13 Then
retval = PLServer1.PopMessage(id, 62, "INVALID BARCODE !!")
retval = PLServer1.Send(id, -1)
Exit Sub
End If
 
Change
If Len(code) <> 8 Or Len(code) <> 13 Then
to
If Len(code) <> 8 AND Len(code) <> 13 Then

Alan

[gray]Experience is something you don't get until just after you need it.[/gray]
 
Excellent - how one little word can make such a difference !!

Thanks for the quick responce
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top