Avatar of Rads R
Rads R
Flag for United States of America

asked on 

Logical operators not working here .... any other alternative

I have this part of the code where it should check for a range of values something like in the code below but it is not doing as it should .... anyone help is greatly appreciated

Thanks
Radhs

If (ValidLotno(Me.tScan.Text)) Then
                S_Lotno = Trim(Me.tScan.Text)
                Me.lblLotno.Caption = S_Lotno
          Else
                ' this is used to check whether it is the first character belongs to a lotno or partno
                  First_char = Left(Me.tScan.Text, 1)
 
                  If (First_char = "1" Or First_char = "2" Or First_char = "3" Or First_char = "4" Or First_char = "5" _
                     Or First_char = "6" Or First_char = "7" Or First_char = "8" Or First_char = "9") Then
                        
                        strMsg = "YOU HAVE SCANNED A WRONG LOTNO ..... PLEASE SCAN THE LOTNO !!! "
                        strTitle = "Incorrect lotno"
                        intresponse = MsgBox(strMsg, vbCritical + vbOKOnly + vbDefaultButton1, strTitle)
                  Else
 
                        strMsg = "YOU HAVE SCANNED A WRONG PARTNO ..... PLEASE SCAN THE CORRECT PARTNO !!! "
                        strTitle = "Incorrect partno"
                        intresponse = MsgBox(strMsg, vbCritical + vbOKOnly + vbDefaultButton1, strTitle)
                  End If

Open in new window

Visual Basic ClassicMicrosoft SQL Server

Avatar of undefined
Last Comment
Rads R

8/22/2022 - Mon