Link to home
Start Free TrialLog in
Avatar of JohnMac328
JohnMac328Flag for United States of America

asked on

Access 2010 - convert memo field to number

I need to convert a memo field to a number.  I want to be able to sort a list by length which should have been a number field to begin with.  If the field is called length what would be the syntax in a query to convert all the values to number?

Many thanks
Avatar of sshah254
sshah254

Did you try cint, clng, cstr ... any of these?

SS
Avatar of JohnMac328

ASKER

I read something about the val function but did not know how to run it in a query.  I am not familiar with the examples you stated
If all the values are numeric just change the format of the field to numbers. If you need deecimals make the datatype single or double. Otherwise long integer will do. I don't see any need for query or code
Ok - it is a memo field and when I try to change it to number it destroys the data - that is why I need something to convert them to numbers
Oh,  did not refresh.
In a query, just use val([Length]) to change the field to regard it as a number.
But you mention its length. Can you givve an example of the conversion you want? val() will only work uop to the first non-numeric value.
These are lengths of Videos so 105 is about the biggest it gets
Try this:

-Right click on the table in the navigation pane and select copy.
-The right click in a blank space in the pane and select paste.
-In the dialog box that opens select structure only
-Open the nex table in design view and change the memo field to text

Create a new query. Don't select any table. Open it in sql view and insert the following sql:

INSERT INTO [Copy Of TableName] SELECT tblEntity.*FROM TableName;
Ok Copy Of TableName is the new table - tablename is the origianl table - what is tblEntity?
I just tried converting a field from memo to numbers and did not loose any data. In my case all the values were numeric. Are there non numeric values in your field. If so what are they.
ASKER CERTIFIED SOLUTION
Avatar of Sheils
Sheils
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Great thanks - just numbers and it looks good.