473,511 Members | 15,581 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem with number and char formatting..

I'm working in Access2000 and am having trouble finding a way to take
imported "OLEPath" field values in my database and filter out or
eliminate all the alpha text so we only get numeral values, allowing
for number formatting. only the first and the last 4 of every value is
text. Here's some examples taken from a table: "A1011.bmp" or
"A201.bmp". I need to get the values to read as "1011" and "201".
Is there a way to do this with SQL Select statement or VBA(if
impossible with SQL.)
plz...i really need a help..

Aug 29 '06 #1
4 2200
Greetings leen

Right(Left([1];Len([1])-4);Len(Left([1];Len([1])-4))-1) will give you
the part you want

It will still be a string though, not a number.

Val(Right(Left([1];Len([1])-4);Len(Left([1];Len([1])-4))-1)) takes
care of that also.

Phivos

leen wrote:
I'm working in Access2000 and am having trouble finding a way to take
imported "OLEPath" field values in my database and filter out or
eliminate all the alpha text so we only get numeral values, allowing
for number formatting. only the first and the last 4 of every value is
text. Here's some examples taken from a table: "A1011.bmp" or
"A201.bmp". I need to get the values to read as "1011" and "201".
Is there a way to do this with SQL Select statement or VBA(if
impossible with SQL.)
plz...i really need a help..
Aug 29 '06 #2
(Where [1] in the example contains the string you want to process)

Phivos wrote:
Greetings leen

Right(Left([1];Len([1])-4);Len(Left([1];Len([1])-4))-1) will give you
the part you want

It will still be a string though, not a number.

Val(Right(Left([1];Len([1])-4);Len(Left([1];Len([1])-4))-1)) takes
care of that also.

Phivos

leen wrote:
I'm working in Access2000 and am having trouble finding a way to take
imported "OLEPath" field values in my database and filter out or
eliminate all the alpha text so we only get numeral values, allowing
for number formatting. only the first and the last 4 of every value is
text. Here's some examples taken from a table: "A1011.bmp" or
"A201.bmp". I need to get the values to read as "1011" and "201".
Is there a way to do this with SQL Select statement or VBA(if
impossible with SQL.)
plz...i really need a help..
Aug 29 '06 #3
On 28 Aug 2006 23:53:23 -0700, leen wrote:
I'm working in Access2000 and am having trouble finding a way to take
imported "OLEPath" field values in my database and filter out or
eliminate all the alpha text so we only get numeral values, allowing
for number formatting. only the first and the last 4 of every value is
text. Here's some examples taken from a table: "A1011.bmp" or
"A201.bmp". I need to get the values to read as "1011" and "201".
Is there a way to do this with SQL Select statement or VBA(if
impossible with SQL.)

plz...i really need a help..
If the first character is always a letter, then, in a query:

NumValue:Val(Mid(OLEPath],2))

will return the number value as a Number datatype.

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Aug 29 '06 #4
Hi Leen,

Put this code in a module, and use it as a normal function, e.g.

cur_value = Extr_int("A1011.bmp")
In this example cur_value = 1011.

Function Extr_int(cur_string As String) As Integer
Dim x As Integer
Dim cur_char As String
Dim new_string As String

For x = 1 To Len(cur_string)
cur_char = Mid(cur_string, x, 1)
Select Case cur_char
Case "0" To "9": new_string = new_string & cur_char
End Select
Next

Extr_int = CInt(new_string)
End Function
I assume it is easy to modify this function for Long integers, or add
further functionality in the case that you only want to have the first
serie of digits.

Success, HBInc.

leen wrote:
I'm working in Access2000 and am having trouble finding a way to take
imported "OLEPath" field values in my database and filter out or
eliminate all the alpha text so we only get numeral values, allowing
for number formatting. only the first and the last 4 of every value is
text. Here's some examples taken from a table: "A1011.bmp" or
"A201.bmp". I need to get the values to read as "1011" and "201".
Is there a way to do this with SQL Select statement or VBA(if
impossible with SQL.)
plz...i really need a help..
Aug 30 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
4619
by: Ian Stanley | last post by:
Hi, Having not done any C programming for a while I am trying to get back into it by converting an old java assignment into C. The problem is I am getting a segmentation fault at runtime which I...
18
6138
by: Ian Stanley | last post by:
Hi, Continuing my strcat segmentation fault posting- I have a problem which occurs when appending two sting literals using strcat. I have tried to fix it by writing my own function that does the...
2
634
by: John S | last post by:
I have created an event handler that is trying to format each number as it is typed. Example If the first char is 1 = output is $1.00 second char is 3 = output is $13.00 next is 5 = $135.00...
0
3910
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
6
1667
by: Larry Lard | last post by:
I am trying to apply the following easy-to-state formatting rule to display a number: - If the number is positive or negative, display it in the 'default' way - If the number is zero, the...
4
1949
by: comp.lang.tcl | last post by:
I wrote this PHP function in the hopes that it would properly use a TCL proc I wrote about 4 years ago: if (!function_exists('proper_case')) { /** * Ths function will convert a string into a...
0
2012
by: raa abdullah | last post by:
Overview A conflict-serializbility\recoverability checker, SCR, is a program that takes in a schedule and outputs 2 decisions: Conflict serialzable or Not confilict serializable AND Recoverable or...
8
8322
by: Manju | last post by:
Hi All, I am facing a strange issue. if the string passed to va_start()/vsnprintf() contains "%n", there is a segmentation fault. If it's replaced with any other character, no issues. Any idea...
3
1906
by: mearvk | last post by:
I am unable to get Xerces to write out attributes from a struct which I am able to print out and verify is correct. The structs are defined below as is subsection of the output. int...
0
7245
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7144
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7356
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7427
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
5069
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3214
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1577
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
449
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.