Forum Discussion
Tony2021
Feb 01, 2022Steel Contributor
Strip Leading Zero's
Hello Experts, How could I strip the leading zeros from invoice numbers so that I can simply compare on the non zeros? My query is below and I have highlighted in red the area that I am looking ...
- Feb 02, 2022you can also use RegExp to extract the number:
Public Function fncAlphaNumber(ByVal varInput As Variant) As Variant
varInput = varInput & ""
fncAlphaNumber = varInput
If Len(varInput) < 1 Then
Exit Function
End If
With CreateObject("vbscript.regexp")
.ignorecase = True
.Global = True
.pattern = "[^a-z0-9]"
varInput = .Replace(varInput, "")
While Left$(varInput, 1) = "0"
varInput = Mid$(varInput, 2)
Wend
End With
fncAlphaNumber = varInput
End Function
NumInvoice: fncAlphaNumber([Invoice #])
Tony2021
Feb 03, 2022Steel Contributor
wow that worked. Why do I need Not Is Null on that particular field? it seems to go against the logic. Is my screen shot below correct?
arnel_gp
Feb 03, 2022Steel Contributor
depends on what are you Filtering.
if you need the filter fields without values, use Is Null.
if you want to filter only those with values, use Not Is Null.
if you need the filter fields without values, use Is Null.
if you want to filter only those with values, use Not Is Null.