473,382 Members | 1,368 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Extracting the Numbers from a field in a query

RobH
56
Hi

I have fields in a database that include numbers eg:

"Slimline Tank - Fibre Plastic : 1,125 l. WHEAT"
I need to effectively extract the 1125 from the above and place it in another Field

And before anyone asks no its not always after the : or in the same possition.
Some Entries dont have a size at all.
Jul 31 '07 #1
2 1954
missinglinq
3,532 Expert 2GB
Where the original data is in YourTextBox and the resulting extracted number is going into a textbox named ExtractedNumber.
Expand|Select|Wrap|Line Numbers
  1. Private Sub YourTextBox_BeforeUpdate(Cancel As Integer)
  2. Dim I As Integer
  3. Dim NumPart As String
  4. NumPart = ""
  5. For I = 1 To Len(Me.YourTextBox)
  6.  If (Asc(Mid(Me.YourTextBox, I, 1)) > 47) And (Asc(Mid(Me.YourTextBox, I, 1)) < 58) Then
  7.    NumPart = NumPart & Mid(Me.YourTextBox, I, 1)
  8.  End If
  9. Next I
  10.  
  11. Me.ExtractedNumber = NumPart
  12. End Sub
  13.  
Notice that the "number" you get is actually a string. If you need to use for for calculations you can convert it to a real number with

Val(Me.ExtractedNumber)

Welcom to TheScrips, Rob!

Linq ;0)>
Jul 31 '07 #2
RobH
56
If i needed to do this as part of a post import process via a query any suggestions?
Jul 31 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: lecichy | last post by:
Hello Heres the situation: I got a file with lines like: name:second_name:somenumber:otherinfo etc with different values between colons ( just like passwd file) What I want is to extract...
6
by: GSpiggle | last post by:
I have a database with records that should have a consecutive number ID (Check Register). Also has other records (deposits and adjusting entries) that don't fit in the number range so...
3
by: Stewart Allen | last post by:
Hi there I'm trying to find part serial numbers between 2 numbers. The user selects a part number from a combo box and then enters a range of serial numbers into 2 text boxes and the resulting...
14
by: amywolfie | last post by:
Hi All: I know this is simple, but I just can't seem to get there: I need to sort a table by a text field (txtDescription), then assign sequential numbers to the field SEQUENCE in table. ...
2
by: bozdog | last post by:
I have recently imported several fields from a spreadsheet(excel) and wish to update a field using an update query. The particular field is imported as a text string and defines a path for a...
9
by: Colin McGuire | last post by:
Hi, I have an report in Microsoft Access and it displays everything in the table. One column called "DECISION" in the table has either 1,2, or 3 in it. On my report it displays 1, 2, or 3. I want...
3
by: Alfred | last post by:
Hi I would like to extract only 15 records at a time from the backend in alfabetic order. Click on a button and then the next 15. Reason data must come over a 56k modem. The data is not...
4
by: apatel85 | last post by:
Hey Guys, Total Number of Records (Based on 5 fields): 1000 Total Unique Records (Based on 5 Fields): 990 Total number of fields: 5 I have question regarding extracting duplicates from the...
3
by: jim | last post by:
Does anyone know why the query below would return numbers? I'm attempting to produce a report that shows in *one* column the names that appear in multiple columns in a single table. Table Name:...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.