A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

String to number



 
 
Thread Tools Display Modes
  #1  
Old May 18th, 2007, 07:43 PM posted to microsoft.public.access.queries
Jeff Klein
external usenet poster
 
Posts: 17
Default String to number

I have created a column in my query that extracts a number from another
field that is a string. I need to convert my new field to be a number so I
can sort properly. Any suggestions??


  #2  
Old May 18th, 2007, 09:02 PM posted to microsoft.public.access.queries
John W. Vinson
external usenet poster
 
Posts: 18,261
Default String to number

On Fri, 18 May 2007 13:43:50 -0500, "Jeff Klein" jklein@nospam wrote:

I have created a column in my query that extracts a number from another
field that is a string. I need to convert my new field to be a number so I
can sort properly. Any suggestions??


Val([fieldname])

will extract the first numeric substring of the information in fieldname as a
Number: e.g. Val("123") = 123, Val("0512ABC") is 512, Val("XY333") is 0
(because there's no initial number).

John W. Vinson [MVP]
  #3  
Old May 18th, 2007, 10:44 PM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default String to number

Try this ---
Val([YourString])
--
KARL DEWEY
Build a little - Test a little


"Jeff Klein" wrote:

I have created a column in my query that extracts a number from another
field that is a string. I need to convert my new field to be a number so I
can sort properly. Any suggestions??



  #4  
Old May 19th, 2007, 09:39 AM posted to microsoft.public.access.queries
Maurice
external usenet poster
 
Posts: 1,585
Default String to number

Or try this:

Cint([yourtext])

remember you'll get a whole number using int.
--
Maurice Ausum


"Jeff Klein" wrote:

I have created a column in my query that extracts a number from another
field that is a string. I need to convert my new field to be a number so I
can sort properly. Any suggestions??



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:08 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.