Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parse a Field in a Query

Status
Not open for further replies.

MacroAlan

Programmer
Dec 4, 2006
137
US
Within my table, there is data like 1000 MHz or 120000 MB that I need to parse into parts and convert to 1 GHz and 120 GB.

Within Excel, I worked out this formula
Code:
=LEFT(C4,FIND(CHAR(32),C4,1)-1)

Access does not seem to like the FIND instruction when I build the parameter. I just want to stip the numeric part of the field so I can manipulate it.

Help! B-(

Alan

It is easier to apologize than ask permission!
 
Have a look at the Instr function. This will return a character's position in the string, which I believe is what you are after.

Good Luck,

Alex

Ignorance of certain subjects is a great part of wisdom
 
If your fields have a numeric at the beginning of the field then you can get the numeric value with
Code:
Val([FieldName])
for example
Code:
Val("120000 MB")
would return the number 120000.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top