Selasa, 07 Juli 2015

[MS_AccessPros] Re: convert text field to number

 

The numbers are really numbers not One hundred


I am just not sure where I put the CLng  in my sql
the query is basic at the moment;

SELECT Glucose_outside_Lab.person_id, Glucose_outside_Lab.observ_value, Glucose_outside_Lab.result_code, Glucose_outside_Lab.obs_date_time, Glucose_outside_Lab.person_nbr
FROM Glucose_outside_Lab;
 

where the observ_value is the field that is text (numbers ranging from 50 to 300), where I would like to convert the text of that field to number
 I gave a couple of stabs at trying to do it but I have not ever done this one before

If you could give me some instructions as to where/what I put to get this to work that would be wonderful
Patty

---In MS_Access_Professionals@yahoogroups.com, <wrmosca@...> wrote :

Patty

Depending on what the numbers are (integers or decimals) all you have to do in most cases is use a built-in function to convert it. Whole numbers like "968" would use CLng or CInt like this:
CLng([myTextNum])

So would be true: CLng("002") < CLng("3")

Decimals would use CDec()

Or are you talking about text like "one hundred"?

Regards,
Bill Mosca, Founder - MS_Access_Professionals
http://www.thatlldoit.com
Microsoft Office Access MVP
http://mvp.microsoft.com/en-us/mvp/Bill%20Mosca-35852
My nothing-to-do-with-Access blog
http://wrmosca.wordpress.com



---In MS_Access_Professionals@yahoogroups.com, <pattykf@...> wrote :

I have a field that the table unfortunately has numbers in text format

I did a search on converting but just can't find a reasonable answer on how to convert it to text. I am sure there is a simple conversion but I can't find it


I eventually want to be able to query the data for less and greater than values so I need it in number format

thank you

Patty

 

__._,_.___

Posted by: pattykf@cox.net
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (3)

.

__,_._,___

Tidak ada komentar:

Posting Komentar