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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

convert a string to a number

Status
Not open for further replies.

nerdcore

MIS
Jan 23, 2003
26
How would I convert a text field in a table to a number on a report or in a query? Because of specific reasons I cannot just change this field to a number field...however I would like to perform a calculation on it as a number, but can't find a function that will let me do this. The text field holds the size of scanned hard drives in bytes and i would like to divide it so I can display it in Gigabytes. Thanks!
 
Hi,

You'll need VBA to do it, use the VAL function which reads a textual string and returns a subset of numbers within that string.

mystr = "101 Highland street"
myval = val(mystr)

myval would hold "101"

Regards,

Darrylle "Never argue with an idiot, he'll bring you down to his level - then beat you with experience." darrylles@totalise.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top