Error Message
-
I am writing a function to check for invalid characters in a file befor written to db but when I run the project I get the following error: Conversion from string "06110-001-000" to type 'Boolean' is not valid. Here is the code I have. Function: Public Function InvalidCharacterCheck(ByVal StringToCheck As String) Dim InvalidChars As String() = {",", ".", "'"} Dim B As String For Each B In InvalidChars If InStr(StringToCheck, B) Then Return True End If Next B Return False End Function Code to handle function: If InvalidCharacterCheck(row("PartNumber") = True Or InvalidCharacterCheck(row("mostforwardpartnumber"))) = True Then ErrorLog("Not Valid partnumber or Supercede partnumber: " & row("PartNumber")) Else Any suggestions? jds1207
-
I am writing a function to check for invalid characters in a file befor written to db but when I run the project I get the following error: Conversion from string "06110-001-000" to type 'Boolean' is not valid. Here is the code I have. Function: Public Function InvalidCharacterCheck(ByVal StringToCheck As String) Dim InvalidChars As String() = {",", ".", "'"} Dim B As String For Each B In InvalidChars If InStr(StringToCheck, B) Then Return True End If Next B Return False End Function Code to handle function: If InvalidCharacterCheck(row("PartNumber") = True Or InvalidCharacterCheck(row("mostforwardpartnumber"))) = True Then ErrorLog("Not Valid partnumber or Supercede partnumber: " & row("PartNumber")) Else Any suggestions? jds1207
jds1207 wrote:
If InvalidCharacterCheck(row("PartNumber") = True Or InvalidCharacterCheck(row("mostforwardpartnumber"))) = True Then
i think it needs to be like this If InvalidCharacterCheck(row("PartNumber")) = True OrElse InvalidCharacterCheck(row("mostforwardpartnumber")) = True Then