var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: String Manipulation
Can anyone tell me if there is a function to return only the numerica characters from the followin string(s):
I want to return only the numerical characters, is there a function in MsAccess to do thi? i have tried using the Instrrev function, but that only seems to work for characters.
Re: String Manipulation
I don't thing so...
You may build a Function with VBA that search the string for numeric characters.
replace function can do it, in access 2000 and up, i think (i cannot check it because i only have access 97)
this should be in the help file (he said, hopefully)
The replace function only allows to replace from one character up to an entire expression. Doesn't support to replace the charecters from "a" to "z".
As i told you you can build a function in VBA to do this and inside that function you will use the replace function.
Try this function.
Public Function StrToNumber(StringIn As String) As Variant
' Accepts a string and returns any numbers
On Error GoTo ErrorProcedure
Dim posn As Integer ' char position in string
Dim str As String ' holds numbers as we find them
For posn = 1 To Len(StringIn)
If IsNumeric(Mid(StringIn, posn, 1)) Then
str = str & Mid(StringIn, posn, 1)
If Len(str) > 0 Then
'Only for testing
StrToNumber = str
'Only for testing
MsgBox "Error in function." & Err.number & Err.Description
my understanding is that you
can use vb functions in access
see About using wildcard characters to search for partial or matching values
that page says you can use wildcards in Replace
thus ... eval(replace(yourfield,'?','')) will strip out the alphabetic characters (the question mark is a wildcard for alphabetics) and evaluate the result as a number
and i'm pretty sure you can use Replace in access 2000, but i do not have it myself, so i must leave it to someone with access 2000 to confirm
Thanks, this worked a treat