AlanW
10-05-2001, 11:28 AM
I have a Field that contains both numbers and text. I would like to filter out just the numbers. What do I need to put in the criteria of the query?
Thanks
Thanks
|
View Full Version : Filtering out Numbers only AlanW 10-05-2001, 11:28 AM I have a Field that contains both numbers and text. I would like to filter out just the numbers. What do I need to put in the criteria of the query? Thanks raskew 10-06-2001, 08:29 AM To leave just the numeric portion of a strong, you could try this: Function removeit(thestuff As String) As String '******************************************* 'Name: removeit (Function) 'Purpose: Remove all non-numeric characters from a string '******************************************* Dim strhold As String, intLen As Integer, n As Integer strhold = RTrim(thestuff) intLen = Len(strhold) strhold = "" For n = 1 To intLen strhold = strhold & IIf(IsNumeric(Mid(thestuff, n, 1)), Mid(thestuff, n, 1), "") Next n removeit = strhold End Function Conversely, to remove the numeric, leaving just the alpha, change this line: IIf(IsNumeric(Mid(thestuff, n, 1)), Mid(thestuff, n, 1), "") to this IIf(Not IsNumeric(Mid(thestuff, n, 1)), Mid(thestuff, n, 1), "") |